$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r66038 - in trunk/libs/filesystem/v3: doc src test
From: bdawes_at_[hidden]
Date: 2010-10-17 08:54:28
Author: bemandawes
Date: 2010-10-17 08:54:26 EDT (Sun, 17 Oct 2010)
New Revision: 66038
URL: http://svn.boost.org/trac/boost/changeset/66038
Log:
For POSIX temp_directory_path, if none of environmental variables are found, try "/tmp".
Text files modified: 
   trunk/libs/filesystem/v3/doc/reference.html       |     6 +++---                                  
   trunk/libs/filesystem/v3/src/operations.cpp       |    12 ++++++------                            
   trunk/libs/filesystem/v3/test/operations_test.cpp |    28 ++++------------------------            
   3 files changed, 13 insertions(+), 33 deletions(-)
Modified: trunk/libs/filesystem/v3/doc/reference.html
==============================================================================
--- trunk/libs/filesystem/v3/doc/reference.html	(original)
+++ trunk/libs/filesystem/v3/doc/reference.html	2010-10-17 08:54:26 EDT (Sun, 17 Oct 2010)
@@ -2453,8 +2453,8 @@
   conventions of the operating system. The specifics of how this path is 
   determined are implementation defined. An error shall be reported if<code> !exists(p) 
   || !is_directory(p)</code>, where <code>p</code> is the path to be returned.</p>
-  <p><i>POSIX:</i> The path supplied by the first environment variable in the 
-  list TMPDIR, TMP, TEMP, TEMPDIR that names an existing directory.</p>
+  <p><i>POSIX:</i> The path supplied by the first environment variable found in the 
+  list TMPDIR, TMP, TEMP, TEMPDIR. If none of these are found, <code>"/tmp"</code>.</p>
   <p><i>Windows:</i> The path reported by the <i>Windows</i> <code>GetTempPath</code> API function.</p>
   <p><i>Throws:</i> As specified in <a href="#Error-reporting">
   Error reporting</a>.</p>
@@ -3089,7 +3089,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 -->16 October 2010<!--webbot bot="Timestamp" endspan i-checksum="32126" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->17 October 2010<!--webbot bot="Timestamp" endspan i-checksum="32128" --></p>
 
 </body>
 
Modified: trunk/libs/filesystem/v3/src/operations.cpp
==============================================================================
--- trunk/libs/filesystem/v3/src/operations.cpp	(original)
+++ trunk/libs/filesystem/v3/src/operations.cpp	2010-10-17 08:54:26 EDT (Sun, 17 Oct 2010)
@@ -1525,12 +1525,12 @@
       (val = std::getenv("TEMP"   )) ||
       (val = std::getenv("TEMPDIR"));
       
-      path p((val!=0)? val : "");
+      path p((val!=0) ? val : "/tmp");
       
-      if(!val||(ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
+      if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
       {
         errno = ENOTDIR;
-        error(true, ec, "boost::filesystem::temp_directory_path");
+        error(true, p, ec, "boost::filesystem::temp_directory_path");
         return p;
       }
         
@@ -1540,7 +1540,7 @@
 
       std::vector<path::value_type> buf(GetTempPathW(0, NULL));
 
-      if(buf.empty() || GetTempPathW(buf.size(), &buf[0])==0)
+      if (buf.empty() || GetTempPathW(buf.size(), &buf[0])==0)
       {
         if(!buf.empty()) ::SetLastError(ENOTDIR);
         error(true, ec, "boost::filesystem::temp_directory_path");
@@ -1551,10 +1551,10 @@
       
       path p(buf.begin(), buf.end());
           
-      if((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
+      if ((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
       {
         ::SetLastError(ENOTDIR);
-        error(true, ec, "boost::filesystem::temp_directory_path");
+        error(true, p, ec, "boost::filesystem::temp_directory_path");
         return path();
       }
       
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	2010-10-17 08:54:26 EDT (Sun, 17 Oct 2010)
@@ -1525,43 +1525,23 @@
         {}                
       };
 
-      try
       {
-        guarded_tmp_vars vars(0, 0, 0, 0);
-        fs::path ph = fs::temp_directory_path();
-        
-        BOOST_TEST(false); // should throw
-      }
-      catch(const boost::filesystem::filesystem_error& e)
-      {
-        BOOST_TEST(e.code() == boost::system::errc::not_a_directory);
-      }
-      
-      {
-          guarded_tmp_vars vars(0, 0, 0, 0);
-          error_code ec;
-          fs::path ph = fs::temp_directory_path(ec);
-          BOOST_TEST(ec);
-          BOOST_TEST(ec == boost::system::errc::not_a_directory);
-      }
-      
-      {
-        guarded_tmp_vars vars(test_temp_dir.BOOST_FILESYSTEM_C_STR, 0, 0, 0);
+        guarded_tmp_vars vars(test_temp_dir.c_str(), 0, 0, 0);
         fs::path ph = fs::temp_directory_path();
         BOOST_TEST(equivalent(test_temp_dir, ph));
       }
       {
-        guarded_tmp_vars vars(0, test_temp_dir.BOOST_FILESYSTEM_C_STR, 0, 0);
+        guarded_tmp_vars vars(0, test_temp_dir.c_str(), 0, 0);
         fs::path ph = fs::temp_directory_path();
         BOOST_TEST(equivalent(test_temp_dir, ph));
       }
       {
-        guarded_tmp_vars vars(0, 0, test_temp_dir.BOOST_FILESYSTEM_C_STR, 0);
+        guarded_tmp_vars vars(0, 0, test_temp_dir.c_str(), 0);
         fs::path ph = fs::temp_directory_path();
         BOOST_TEST(equivalent(test_temp_dir, ph));
       }
       {
-        guarded_tmp_vars vars(0, 0, 0, test_temp_dir.BOOST_FILESYSTEM_C_STR);
+        guarded_tmp_vars vars(0, 0, 0, test_temp_dir.c_str());
         fs::path ph = fs::temp_directory_path();
         BOOST_TEST(equivalent(test_temp_dir, ph));
       }