Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67599 - in trunk: boost/filesystem/v3 libs/filesystem/v3/src libs/filesystem/v3/test libs/filesystem/v3/test/msvc10/windows_attributes
From: bdawes_at_[hidden]
Date: 2011-01-02 17:06:28


Author: bemandawes
Date: 2011-01-02 17:06:26 EST (Sun, 02 Jan 2011)
New Revision: 67599
URL: http://svn.boost.org/trac/boost/changeset/67599

Log:
fix status() to report non-symlink reparse point correctly.
Text files modified:
   trunk/boost/filesystem/v3/operations.hpp | 4 ++--
   trunk/libs/filesystem/v3/src/operations.cpp | 3 +++
   trunk/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj | 10 ++++++++++
   trunk/libs/filesystem/v3/test/windows_attributes.cpp | 34 ++++++++++++++++++++++++++++++++--
   4 files changed, 47 insertions(+), 4 deletions(-)

Modified: trunk/boost/filesystem/v3/operations.hpp
==============================================================================
--- trunk/boost/filesystem/v3/operations.hpp (original)
+++ trunk/boost/filesystem/v3/operations.hpp 2011-01-02 17:06:26 EST (Sun, 02 Jan 2011)
@@ -75,8 +75,8 @@
     fifo_file,
     socket_file,
     reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
- type_unknown, // file does exist, but isn't one of the above types or
- // we don't have strong enough permission to find its type
+ type_unknown, // file does exist, but isn't one of the above types or
+ // we don't have strong enough permission to find its type
 
     _detail_directory_symlink // internal use only; never exposed to users
   };

Modified: trunk/libs/filesystem/v3/src/operations.cpp
==============================================================================
--- trunk/libs/filesystem/v3/src/operations.cpp (original)
+++ trunk/libs/filesystem/v3/src/operations.cpp 2011-01-02 17:06:26 EST (Sun, 02 Jan 2011)
@@ -1448,6 +1448,9 @@
       {
         return process_status_failure(p, ec);
       }
+
+ if (!is_reparse_point_a_symlink(p))
+ return file_status(reparse_file);
     }
 
     if (ec != 0) ec->clear();

Modified: trunk/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj
==============================================================================
--- trunk/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj (original)
+++ trunk/libs/filesystem/v3/test/msvc10/windows_attributes/windows_attributes.vcxproj 2011-01-02 17:06:26 EST (Sun, 02 Jan 2011)
@@ -32,9 +32,11 @@
   </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\common.props" />
   </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\common.props" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -76,6 +78,14 @@
   <ItemGroup>
     <ClCompile Include="..\..\windows_attributes.cpp" />
   </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj">
+ <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\system_dll\system_dll.vcxproj">
+ <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project>
+ </ProjectReference>
+ </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>

Modified: trunk/libs/filesystem/v3/test/windows_attributes.cpp
==============================================================================
--- trunk/libs/filesystem/v3/test/windows_attributes.cpp (original)
+++ trunk/libs/filesystem/v3/test/windows_attributes.cpp 2011-01-02 17:06:26 EST (Sun, 02 Jan 2011)
@@ -13,6 +13,8 @@
 
 //--------------------------------------------------------------------------------------//
 
+#include <boost/filesystem.hpp>
+#include <boost/detail/lightweight_main.hpp>
 #include <windows.h>
 #include <map>
 #include <utility>
@@ -20,8 +22,9 @@
 #include <string>
 
 using std::make_pair;
+namespace fs = boost::filesystem;
 
-int main( int argc, char* argv[])
+int cpp_main( int argc, char* argv[])
 {
   typedef std::map<DWORD, std::string> decode_type;
   decode_type table;
@@ -47,6 +50,8 @@
     return 1;
   }
 
+ // report Win32 ::GetFileAttributesA()
+
   DWORD at(::GetFileAttributesA(argv[1]));
   if (at == INVALID_FILE_ATTRIBUTES)
   {
@@ -72,7 +77,32 @@
   std::cout << std::endl;
 
   if (at)
- std::cout << "plus unknown attributes " << at << std::endl;
+ std::cout << "plus unknown attributes " << at << std::endl;
+
+ // report Boost Filesystem file_type
+
+ fs::file_status stat = fs::status(argv[1]);
+
+ const char* types[] =
+ {
+ "status_error",
+ "file_not_found",
+ "regular_file",
+ "directory_file",
+ // the following may not apply to some operating systems or file systems
+ "symlink_file",
+ "block_file",
+ "character_file",
+ "fifo_file",
+ "socket_file",
+ "reparse_file", // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
+ "type_unknown", // file does exist", but isn't one of the above types or
+ // we don't have strong enough permission to find its type
+
+ "_detail_directory_symlink" // internal use only; never exposed to users
+ };
+
+ std::cout << "boost::filesystem::status().type() is " << types[stat.type()] << std::endl;
 
   return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk