Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67571 - in trunk: boost/filesystem/v3 libs/filesystem/v3/doc libs/filesystem/v3/test
From: bdawes_at_[hidden]
Date: 2011-01-02 09:59:09


Author: bemandawes
Date: 2011-01-02 09:59:04 EST (Sun, 02 Jan 2011)
New Revision: 67571
URL: http://svn.boost.org/trac/boost/changeset/67571

Log:
Undeprecate unique_path(). Instead, add a note mentioning the workaround for lack of thread safety and possible change to cwd. unique_path() is just too convenient to deprecate!
Text files modified:
   trunk/boost/filesystem/v3/operations.hpp | 6 +-----
   trunk/libs/filesystem/v3/doc/reference.html | 26 +++++++++++++++++++++++---
   trunk/libs/filesystem/v3/test/operations_test.cpp | 32 ++++++++++++++++----------------
   3 files changed, 40 insertions(+), 24 deletions(-)

Modified: trunk/boost/filesystem/v3/operations.hpp
==============================================================================
--- trunk/boost/filesystem/v3/operations.hpp (original)
+++ trunk/boost/filesystem/v3/operations.hpp 2011-01-02 09:59:04 EST (Sun, 02 Jan 2011)
@@ -260,9 +260,7 @@
  
   // forward declarations
   path current_path(); // fwd declaration
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
   path initial_path();
-# endif
 
   BOOST_FILESYSTEM_DECL
   path absolute(const path& p, const path& base=current_path());
@@ -374,7 +372,6 @@
   inline
   boost::uintmax_t hard_link_count(const path& p, system::error_code& ec)
                                        {return detail::hard_link_count(p, &ec);}
-# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
   inline
   path initial_path() {return detail::initial_path();}
 
@@ -385,7 +382,6 @@
   path initial_path() {return initial_path();}
   template <class Path>
   path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
-# endif
 
   inline
   std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
@@ -972,6 +968,7 @@
     using filesystem3::file_type;
     using filesystem3::filesystem_error;
     using filesystem3::hard_link_count;
+ using filesystem3::initial_path;
     using filesystem3::is_directory;
     using filesystem3::is_directory;
     using filesystem3::is_empty;
@@ -999,7 +996,6 @@
     using filesystem3::type_unknown;
     using filesystem3::unique_path;
 # ifndef BOOST_FILESYSTEM_NO_DEPRECATED
- using filesystem3::initial_path;
     using filesystem3::is_regular;
     using filesystem3::status_unknown;
     using filesystem3::symbolic_link_exists;

Modified: trunk/libs/filesystem/v3/doc/reference.html
==============================================================================
--- trunk/libs/filesystem/v3/doc/reference.html (original)
+++ trunk/libs/filesystem/v3/doc/reference.html 2011-01-02 09:59:04 EST (Sun, 02 Jan 2011)
@@ -5,7 +5,7 @@
 <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
 <meta name="ProgId" content="FrontPage.Editor.Document">
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<title>Filesystem Reference
+<title>Filesystem V3 Reference
 </title>
 <link rel="stylesheet" type="text/css" href="../../../../doc/src/minimal.css">
 </head>
@@ -98,6 +98,7 @@
 &nbsp;&nbsp;&nbsp;&nbsp exists<br>
 &nbsp;&nbsp;&nbsp;&nbsp equivalent<br>
 &nbsp;&nbsp;&nbsp;&nbsp file_size<br>
+&nbsp;&nbsp;&nbsp;&nbsp; initial_path<br>
 &nbsp;&nbsp;&nbsp;&nbsp is_directory<br>
 &nbsp;&nbsp;&nbsp;&nbsp is_empty<br>
 &nbsp;&nbsp;&nbsp;&nbsp is_other<br>
@@ -385,7 +386,10 @@
 <pre> uintmax_t hard_link_count(const path&amp; p);
       uintmax_t hard_link_count(const path&amp; p, system::error_code&amp; ec);
 
- bool is_directory(file_status s);
+ <span style="background-color: #FFFFFF">const path&amp; initial_path();
+ const path&amp; initial_path(</span><code>system::error_code&amp; ec</code><span style="background-color: #FFFFFF">);
+
+</span> bool is_directory(file_status s);
       bool is_directory(const path&amp; p);
       bool is_directory(const path&amp; p, system::error_code&amp; ec);
 
@@ -2072,8 +2076,10 @@
   <a href="#Error-reporting">
   Error reporting</a>.</p>
 </blockquote>
+<div dir="ltr">
 <pre><span style="background-color: #FFFFFF; ">uintmax_t</span> <a name="file_size">file_size</a>(const path&amp; p);<span style="background-color: #FFFFFF; ">
 uintmax_t</span> <a name="file_size2">file_size</a>(const path&amp; p, system::error_code&amp; ec);</pre>
+</div>
 <blockquote>
   <p><span style="background-color: #FFFF00">Remarks: </span></p>
   <p><i>Returns:</i> If <code>exists(p) &amp;&amp; is_regular_file(p)</code>, the size
@@ -2088,6 +2094,20 @@
   <a href="#Error-reporting">
   Error reporting</a>.</p>
 </blockquote>
+<pre><span style="background-color: #FFFFFF">const path&amp; <a name="initial_path">initial_path</a>();
+const path&amp; <a name="initial_path">initial_path</a>(</span><code>system::error_code&amp; ec</code><span style="background-color: #FFFFFF">);</span></pre>
+<blockquote>
+ <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
+ <code>current_path()</code> as of the first call to <code>initial_path()</code>.</p>
+ <p>[<i><span style="background-color: #FFFFFF">Note:</span></i> <code>
+ initial_path()</code> is not thread safe, and may return an undesirable result
+ if called subsequent to a change to the current directory. These problems can
+ be avoided by calling <code>initial_path()</code> immediately on entry to
+ main().&nbsp; <i><span style="background-color: #FFFFFF">--end note</span></i>]</p>
+ <p><i>Throws:</i> For the first call, as specified in
+ <a href="#Error-reporting">
+ Error reporting</a>. Subsequent calls throw nothing.</p>
+</blockquote>
 <pre><span style="background-color: #FFFFFF">bool </span><code><span style="background-color: #FFFFFF"><a name="is_directory">is_directory</a></span></code><span style="background-color: #FFFFFF">(file_status s);</span></pre>
 <blockquote>
   <p><i><span style="background-color: #FFFFFF">Returns:</span></i><span style="background-color: #FFFFFF"> </span>
@@ -3089,7 +3109,7 @@
 <p>Distributed under the Boost Software License, Version 1.0. See
 <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->17 October 2010<!--webbot bot="Timestamp" endspan i-checksum="32128" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->02 January 2011<!--webbot bot="Timestamp" endspan i-checksum="32200" --></p>
 
 </body>
 

Modified: trunk/libs/filesystem/v3/test/operations_test.cpp
==============================================================================
--- trunk/libs/filesystem/v3/test/operations_test.cpp (original)
+++ trunk/libs/filesystem/v3/test/operations_test.cpp 2011-01-02 09:59:04 EST (Sun, 02 Jan 2011)
@@ -89,7 +89,6 @@
   std::string platform(BOOST_PLATFORM);
   bool report_throws;
   bool cleanup = true;
- fs::path init_path(fs::current_path());
   fs::directory_iterator end_itr;
   fs::path dir;
   fs::path d1;
@@ -1352,20 +1351,20 @@
         && dir.string()[1] == ':'); // verify path includes drive
 
       BOOST_TEST(fs::system_complete("").empty());
- BOOST_TEST(fs::system_complete("/") == init_path.root_path());
+ BOOST_TEST(fs::system_complete("/") == fs::initial_path().root_path());
       BOOST_TEST(fs::system_complete("foo")
- == init_path / "foo");
+ == fs::initial_path() / "foo");
 
       fs::path p1(fs::system_complete("/foo"));
       BOOST_TEST_EQ(p1.string().size(), 6U); // this failed during v3 development due to bug
       std::string s1(p1.string() );
- std::string s2(init_path.root_path().string()+"foo");
+ std::string s2(fs::initial_path().root_path().string()+"foo");
       BOOST_TEST_EQ(s1, s2);
 
- BOOST_TEST(fs::system_complete(fs::path(init_path.root_name()))
- == init_path);
- BOOST_TEST(fs::system_complete(fs::path(init_path.root_name().string()
- + "foo")).string() == init_path / "foo");
+ BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name()))
+ == fs::initial_path());
+ BOOST_TEST(fs::system_complete(fs::path(fs::initial_path().root_name().string()
+ + "foo")).string() == fs::initial_path() / "foo");
       BOOST_TEST(fs::system_complete(fs::path("c:/")).generic_string()
         == "c:/");
       BOOST_TEST(fs::system_complete(fs::path("c:/foo")).generic_string()
@@ -1378,12 +1377,12 @@
     {
       std::cout << "POSIX specific tests..." << std::endl;
       BOOST_TEST(fs::system_complete("").empty());
- BOOST_TEST(init_path.root_path().string() == "/");
+ BOOST_TEST(fs::initial_path().root_path().string() == "/");
       BOOST_TEST(fs::system_complete("/").string() == "/");
       BOOST_TEST(fs::system_complete("foo").string()
- == init_path.string()+"/foo");
+ == fs::initial_path().string()+"/foo");
       BOOST_TEST(fs::system_complete("/foo").string()
- == init_path.root_path().string()+"foo");
+ == fs::initial_path().root_path().string()+"foo");
     } // POSIX
   }
 
@@ -1394,11 +1393,12 @@
     std::cout << "initial_tests..." << std::endl;
 
     std::cout << " current_path().string() is\n \""
- << init_path.string()
+ << fs::initial_path().string()
               << "\"\n\n";
- BOOST_TEST(init_path.is_absolute());
+ BOOST_TEST(fs::initial_path() == fs::current_path());
+ BOOST_TEST(fs::initial_path().is_absolute());
     BOOST_TEST(fs::current_path().is_absolute());
- BOOST_TEST(init_path.string()
+ BOOST_TEST(fs::initial_path().string()
       == fs::current_path().string());
   }
 
@@ -1506,7 +1506,7 @@
       BOOST_TEST(!exists(ph));
     }
     
- fs::path test_temp_dir = init_path;
+ fs::path test_temp_dir = fs::initial_path();
 
 #if defined BOOST_POSIX_API
     {
@@ -1652,7 +1652,7 @@
 # endif
   std::cout << "API is " << platform << std::endl;
 
- dir = init_path / temp_dir_name;
+ dir = fs::initial_path() / temp_dir_name;
 
   if (fs::exists(dir))
   {


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