Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71157 - in trunk/libs/filesystem/v3: src test
From: bdawes_at_[hidden]
Date: 2011-04-09 22:00:36


Author: bemandawes
Date: 2011-04-09 22:00:35 EDT (Sat, 09 Apr 2011)
New Revision: 71157
URL: http://svn.boost.org/trac/boost/changeset/71157

Log:
Fix #5405. Note that this is only a partial fix. The issue is much larger; see ticket 5448 for details.
Text files modified:
   trunk/libs/filesystem/v3/src/path.cpp | 14 ++++++++++
   trunk/libs/filesystem/v3/test/path_test.cpp | 52 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 66 insertions(+), 0 deletions(-)

Modified: trunk/libs/filesystem/v3/src/path.cpp
==============================================================================
--- trunk/libs/filesystem/v3/src/path.cpp (original)
+++ trunk/libs/filesystem/v3/src/path.cpp 2011-04-09 22:00:35 EDT (Sat, 09 Apr 2011)
@@ -84,6 +84,7 @@
   const wchar_t* preferred_separator_string = L"\\";
   const wchar_t colon = L':';
   const wchar_t dot = L'.';
+ const wchar_t questionmark = L'?';
   const fs::path dot_path(L".");
   const fs::path dot_dot_path(L"..");
 
@@ -490,6 +491,19 @@
       && is_separator(path[0])
       && is_separator(path[1])) return string_type::npos;
 
+# ifdef BOOST_WINDOWS_API
+ // case "\\?\"
+ if (size > 4
+ && is_separator(path[0])
+ && is_separator(path[1])
+ && path[2] == questionmark
+ && is_separator(path[3]))
+ {
+ string_type::size_type pos(path.find_first_of(separators, 4));
+ return pos < size ? pos : string_type::npos;
+ }
+# endif
+
     // case "//net {/}"
     if (size > 3
       && is_separator(path[0])

Modified: trunk/libs/filesystem/v3/test/path_test.cpp
==============================================================================
--- trunk/libs/filesystem/v3/test/path_test.cpp (original)
+++ trunk/libs/filesystem/v3/test/path_test.cpp 2011-04-09 22:00:35 EDT (Sat, 09 Apr 2011)
@@ -1070,6 +1070,26 @@
 
     if (platform == "Windows")
     {
+
+ //p = q = L"\\\\?\\";
+ //BOOST_TEST(p.relative_path().string() == "");
+ //BOOST_TEST(p.parent_path().string() == "");
+ //BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ //BOOST_TEST(p.filename() == "");
+ //BOOST_TEST(p.stem() == "");
+ //BOOST_TEST(p.extension() == "");
+ //BOOST_TEST(p.root_name() == "");
+ //BOOST_TEST(p.root_directory() == "");
+ //BOOST_TEST(p.root_path().string() == "");
+ //BOOST_TEST(!p.has_root_path());
+ //BOOST_TEST(!p.has_root_name());
+ //BOOST_TEST(!p.has_root_directory());
+ //BOOST_TEST(!p.has_relative_path());
+ //BOOST_TEST(!p.has_filename());
+ //BOOST_TEST(!p.has_stem());
+ //BOOST_TEST(!p.has_extension());
+ //BOOST_TEST(!p.has_parent_path());
+ //BOOST_TEST(!p.is_absolute());
 
       p = q = path("c:");
       BOOST_TEST(p.relative_path().string() == "");
@@ -1086,6 +1106,22 @@
       BOOST_TEST(p.has_filename());
       BOOST_TEST(!p.has_parent_path());
       BOOST_TEST(!p.is_absolute());
+
+ //p = q = path(L"\\\\?\\c:");
+ //BOOST_TEST(p.relative_path().string() == "");
+ //BOOST_TEST(p.parent_path().string() == "");
+ //BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ //BOOST_TEST(p.filename() == "c:");
+ //BOOST_TEST(p.root_name() == "c:");
+ //BOOST_TEST(p.root_directory() == "");
+ //BOOST_TEST(p.root_path().string() == "c:");
+ //BOOST_TEST(p.has_root_path());
+ //BOOST_TEST(p.has_root_name());
+ //BOOST_TEST(!p.has_root_directory());
+ //BOOST_TEST(!p.has_relative_path());
+ //BOOST_TEST(p.has_filename());
+ //BOOST_TEST(!p.has_parent_path());
+ //BOOST_TEST(!p.is_absolute());
 
       p = q = path("c:foo");
       BOOST_TEST(p.relative_path().string() == "foo");
@@ -1102,6 +1138,22 @@
       BOOST_TEST(p.has_filename());
       BOOST_TEST(p.has_parent_path());
       BOOST_TEST(!p.is_absolute());
+
+ //p = q = path(L"\\\\?\\c:foo");
+ //BOOST_TEST(p.relative_path().string() == "foo");
+ //BOOST_TEST(p.parent_path().string() == "c:");
+ //BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ //BOOST_TEST(p.filename() == "foo");
+ //BOOST_TEST(p.root_name() == "c:");
+ //BOOST_TEST(p.root_directory() == "");
+ //BOOST_TEST(p.root_path().string() == "c:");
+ //BOOST_TEST(p.has_root_path());
+ //BOOST_TEST(p.has_root_name());
+ //BOOST_TEST(!p.has_root_directory());
+ //BOOST_TEST(p.has_relative_path());
+ //BOOST_TEST(p.has_filename());
+ //BOOST_TEST(p.has_parent_path());
+ //BOOST_TEST(!p.is_absolute());
    
       p = q = path("c:/");
       BOOST_TEST(p.relative_path().string() == "");


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