diff --git a/v3/doc/reference.html b/v3/doc/reference.html index ba3eb6e..d3e6cec 100644 --- a/v3/doc/reference.html +++ b/v3/doc/reference.html @@ -2453,8 +2453,8 @@ path temp_directory_path(system::error_code& ec); conventions of the operating system. The specifics of how this path is determined are implementation defined. An error shall be reported if !exists(p) || !is_directory(p), where p is the path to be returned.

-

POSIX: The path supplied by the first environment variable in the - list TMPDIR, TMP, TEMP, TEMPDIR that names an existing directory.

+

POSIX: The path supplied by the first environment variable found in the + list TMPDIR, TMP, TEMP, TEMPDIR. If none of these are found, "/tmp".

Windows: The path reported by the Windows GetTempPath API function.

Throws: As specified in Error reporting.

@@ -3089,7 +3089,7 @@ multiple string types. His idea became the basis for the version 3 path design.<

Distributed under the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt

Revised -16 October 2010

+17 October 2010

diff --git a/v3/src/operations.cpp b/v3/src/operations.cpp index eded64d..76b4f70 100644 --- a/v3/src/operations.cpp +++ b/v3/src/operations.cpp @@ -1525,12 +1525,12 @@ namespace detail (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 @@ namespace detail std::vector 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 @@ namespace detail 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(); } diff --git a/v3/test/operations_test.cpp b/v3/test/operations_test.cpp index ff535ec..473c8fe 100644 --- a/v3/test/operations_test.cpp +++ b/v3/test/operations_test.cpp @@ -1525,43 +1525,23 @@ namespace {} }; - 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)); }