summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/filesystem/test/issues
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/filesystem/test/issues')
-rw-r--r--src/boost/libs/filesystem/test/issues/10038.cpp8
-rw-r--r--src/boost/libs/filesystem/test/issues/10205.cpp17
-rw-r--r--src/boost/libs/filesystem/test/issues/10485.cpp14
-rw-r--r--src/boost/libs/filesystem/test/issues/10641.cpp20
-rw-r--r--src/boost/libs/filesystem/test/issues/11166-remove-race.cpp38
-rw-r--r--src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp25
-rw-r--r--src/boost/libs/filesystem/test/issues/3332/test.cpp37
-rw-r--r--src/boost/libs/filesystem/test/issues/4329.-basename.cpp20
-rw-r--r--src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp0
-rw-r--r--src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp36
-rw-r--r--src/boost/libs/filesystem/test/issues/70-71-copy.cpp20
-rw-r--r--src/boost/libs/filesystem/test/issues/8930.cpp7
-rw-r--r--src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp10
-rw-r--r--src/boost/libs/filesystem/test/issues/9219.cpp40
-rw-r--r--src/boost/libs/filesystem/test/issues/Jamfile.v238
-rw-r--r--src/boost/libs/filesystem/test/issues/boost-no-inspect0
-rw-r--r--src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp14
-rw-r--r--src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp38
-rw-r--r--src/boost/libs/filesystem/test/issues/hello_filesystem.cpp39
-rw-r--r--src/boost/libs/filesystem/test/issues/readme.txt9
-rw-r--r--src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp132
21 files changed, 562 insertions, 0 deletions
diff --git a/src/boost/libs/filesystem/test/issues/10038.cpp b/src/boost/libs/filesystem/test/issues/10038.cpp
new file mode 100644
index 00000000..341e7a94
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/10038.cpp
@@ -0,0 +1,8 @@
+#include <boost/filesystem.hpp>
+
+int main(void)
+{
+ boost::filesystem::copy_file("a", "b");
+ return 0;
+}
+
diff --git a/src/boost/libs/filesystem/test/issues/10205.cpp b/src/boost/libs/filesystem/test/issues/10205.cpp
new file mode 100644
index 00000000..4cf5e728
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/10205.cpp
@@ -0,0 +1,17 @@
+// Linux test; before running: export LANG=foo
+
+#include <locale>
+#include <iostream>
+#include <string>
+#include <boost/filesystem/path.hpp>
+
+int main()
+{
+ std::string pathname = "/some/filesystem/path/%%%%";
+
+ boost::filesystem::path path(pathname);
+
+ std::wcout << path.wstring() << std::endl;
+
+ return 0;
+}
diff --git a/src/boost/libs/filesystem/test/issues/10485.cpp b/src/boost/libs/filesystem/test/issues/10485.cpp
new file mode 100644
index 00000000..81ba2136
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/10485.cpp
@@ -0,0 +1,14 @@
+// Copyright iamvfx@gmail.com 2014
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <stdio.h>
+#include <boost/filesystem.hpp>
+
+int main()
+{
+ boost::filesystem::path dir("/");
+ for (char c : dir.filename().string())
+ printf("%c\n", c);
+}
diff --git a/src/boost/libs/filesystem/test/issues/10641.cpp b/src/boost/libs/filesystem/test/issues/10641.cpp
new file mode 100644
index 00000000..ff90784e
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/10641.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <boost/filesystem/path.hpp>
+using namespace std;
+namespace fs = boost::filesystem;
+int main(int argc, char** argv)
+{
+
+ try
+ {
+ fs::path my_path("test/test.txt");
+ cout << "current path is " << my_path << endl;
+ cout << "parent path is " << my_path.parent_path() << endl;
+ }
+ catch(std::exception& e) {
+ cerr << endl << "Error during execution: " << e.what() << endl << endl;
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+}
+
diff --git a/src/boost/libs/filesystem/test/issues/11166-remove-race.cpp b/src/boost/libs/filesystem/test/issues/11166-remove-race.cpp
new file mode 100644
index 00000000..e5ba61a5
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/11166-remove-race.cpp
@@ -0,0 +1,38 @@
+#include <boost/filesystem.hpp>
+#include <boost/thread.hpp>
+#include <fstream>
+
+boost::condition_variable cond;
+boost::mutex mut;
+
+#define FNAME ("remove-test")
+void remover()
+{
+ while(1)
+ {
+ boost::filesystem::remove(FNAME);
+ }
+}
+
+void creater()
+{
+ for(int i=0; i<100000; i++) std::fstream(FNAME, std::fstream::out);
+}
+
+int main()
+{
+ boost::filesystem::remove(FNAME);
+ boost::filesystem::remove(FNAME);
+
+ std::cout <<
+ "If you got this far, it's OK to remove a file that doesn't exist\n"
+ "Now trying with one creator thread and two remover threads.\n"
+ "This is likely to crash after just a few seconds at most." <<
+ std::endl;
+
+ boost::thread c(creater), r1(remover), r2(remover);
+
+ c.join();
+ r1.interrupt(); r1.join();
+ r2.interrupt(); r2.join();
+}
diff --git a/src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp b/src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp
new file mode 100644
index 00000000..ac44d2d6
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp
@@ -0,0 +1,25 @@
+#include <boost/filesystem.hpp>
+#include <boost/range.hpp>
+#include <boost/range/algorithm.hpp>
+#include <boost/range/adaptors.hpp>
+#include <vector>
+#include <iostream>
+
+namespace fs = boost::filesystem;
+using namespace boost::adaptors;
+
+int main() {
+ fs::recursive_directory_iterator beg("."), end;
+
+ auto fileFilter = [](fs::path const & path)
+ {
+ return is_regular_file(path);
+ };
+
+ std::vector<fs::path> paths;
+ copy(boost::make_iterator_range(beg, end) | filtered(fileFilter),
+ std::back_inserter(paths));
+
+ for(auto& p : paths)
+ std::cout << p << "\n";
+} \ No newline at end of file
diff --git a/src/boost/libs/filesystem/test/issues/3332/test.cpp b/src/boost/libs/filesystem/test/issues/3332/test.cpp
new file mode 100644
index 00000000..9456a7a8
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/3332/test.cpp
@@ -0,0 +1,37 @@
+#include <boost/filesystem.hpp>
+#include <cvt/cp950>
+#include <iostream>
+#include <string>
+#include <locale>
+
+namespace fs = boost::filesystem;
+
+int main(void) {
+
+ std::locale global_loc = std::locale();
+ std::locale loc(global_loc, new stdext::cvt::codecvt_cp950<wchar_t>);
+ fs::path::imbue(loc);
+
+ std::cout <<
+ "HEADS UP! PIPE OUTPUT TO FILE AND INSPECT WITH HEX OR CP950 EDITOR.\n"
+ "WINDOWS COMMAND PROMPT FONTS DON'T SUPPORT CHINESE,\n"
+ "EVEN WITH CODEPAGE SET AND EVEN AS OF WIN 10 TECH PREVIEW." << std::endl;
+
+ fs::recursive_directory_iterator end;
+ fs::recursive_directory_iterator iter
+ ("C:/boost/test-files/utf-8");
+
+ while (iter != end)
+ {
+ if (fs::is_directory(*iter))
+ {
+ std::cout << "[directory] " << iter->path().generic_string() << std::endl;
+ }
+ else if (fs::is_regular(*iter))
+ {
+ std::cout << " [file] " << iter->path().generic_string() << std::endl;
+ }
+ ++iter;
+ }
+ return 0;
+}
diff --git a/src/boost/libs/filesystem/test/issues/4329.-basename.cpp b/src/boost/libs/filesystem/test/issues/4329.-basename.cpp
new file mode 100644
index 00000000..a07648b3
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/4329.-basename.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <boost/filesystem.hpp>
+using boost::filesystem::path;
+
+int main()
+{
+ std::cout << path("a").stem() << std::endl;
+ std::cout << path("a/").stem() << std::endl;
+ std::cout << path("a/b").stem() << std::endl;
+ std::cout << path("a/b/").stem() << std::endl;
+ std::cout << path("a/b/c").stem() << std::endl;
+ std::cout << path("a/b/c/").stem() << std::endl;
+ std::cout << path("a/b/c/d").stem() << std::endl;
+ std::cout << path("a/b/c/d/").stem() << std::endl;
+ std::cout << path("a/b/c/d/e").stem() << std::endl;
+ std::cout << path("a/b/c/d/e/").stem() << std::endl;
+ return 0;
+}
+
+
diff --git a/src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp b/src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp
diff --git a/src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp b/src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp
new file mode 100644
index 00000000..b0a62ede
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp
@@ -0,0 +1,36 @@
+#include <boost/filesystem.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include <string>
+
+using namespace boost::filesystem;
+
+// The original bug report was that this broke:
+// path p(L"C:\\TEMP\\");
+// path r(p / "narrow");
+// That code now works, but ...
+
+// Nils Gladitz has provided this example ...
+
+class Test
+{
+public:
+ ~Test()
+ {
+ path p(L"C:\\TEMP\\");
+ path r(p / "narrow");
+ }
+};
+
+// path p("narrow");
+
+// fails if static linked and Test object is global variable, but does not fail if
+// path p("narrow") line above is not commented out, and also does not fail if the
+// Test test2 line below is commented out.
+
+Test test1;
+Test test2;
+
+int cpp_main(int, char* [])
+{
+ return 0;
+}
diff --git a/src/boost/libs/filesystem/test/issues/70-71-copy.cpp b/src/boost/libs/filesystem/test/issues/70-71-copy.cpp
new file mode 100644
index 00000000..ed67f170
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/70-71-copy.cpp
@@ -0,0 +1,20 @@
+
+// Copyright 2018 Peter Dimov.
+//
+// Distributed under the Boost Software License, Version 1.0.
+//
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+
+// See library home page at http://www.boost.org/libs/filesystem
+
+#include <boost/filesystem.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+namespace fs = boost::filesystem;
+
+int main()
+{
+ BOOST_TEST_THROWS( fs::copy( "/tmp/non-existent-a", "/tmp/non-existent-b" ), std::exception );
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/filesystem/test/issues/8930.cpp b/src/boost/libs/filesystem/test/issues/8930.cpp
new file mode 100644
index 00000000..280e5ed6
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/8930.cpp
@@ -0,0 +1,7 @@
+// Before running this test: export LANG=foo
+
+#include <boost/filesystem.hpp>
+int main() {
+ boost::filesystem::path("/abc").root_directory();
+}
+
diff --git a/src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp b/src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp
new file mode 100644
index 00000000..e30617e0
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp
@@ -0,0 +1,10 @@
+#include "boost/filesystem.hpp"
+
+static const boost::filesystem::path::codecvt_type &dummy =
+ boost::filesystem::path::codecvt();
+
+int main()
+{
+ return 0;
+}
+
diff --git a/src/boost/libs/filesystem/test/issues/9219.cpp b/src/boost/libs/filesystem/test/issues/9219.cpp
new file mode 100644
index 00000000..85d4b5c7
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/9219.cpp
@@ -0,0 +1,40 @@
+// Boost 9219.cpp --------------------------------------------------------------------//
+
+// Copyright Beman Dawes 2014
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+// //
+// In researching filesystem issues it is convenient to have a program that can be //
+// quickly modified to test reported problems. That's the purpose of this file and //
+// its associated Visual Studio and Boost.Build infrastructure. //
+// //
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config/warning_disable.hpp>
+
+#include <boost/filesystem.hpp>
+
+#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
+
+using std::cout;
+using std::endl;
+namespace fs = boost::filesystem;
+
+//------------------------------------ cpp_main --------------------------------------//
+
+int cpp_main(int argc, char* argv[])
+{
+ cout << "Hello, 9219" << endl;
+ cout << "This is a test for non-Windows systems" << endl;
+
+ BOOST_TEST(fs::exists(const_cast<char*>(".")));
+
+ return ::boost::report_errors();
+} // cpp_main
diff --git a/src/boost/libs/filesystem/test/issues/Jamfile.v2 b/src/boost/libs/filesystem/test/issues/Jamfile.v2
new file mode 100644
index 00000000..47fce407
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/Jamfile.v2
@@ -0,0 +1,38 @@
+# Boost Filesystem test/issues Jamfile
+
+# Copyright Beman Dawes 2014
+
+# Distributed under the Boost Software License, Version 1.0.
+# See www.boost.org/LICENSE_1_0.txt
+
+# Library home page: http://www.boost.org/libs/filesystem
+
+project
+ : requirements
+ <library>/boost/filesystem//boost_filesystem
+ <link>static
+ ;
+
+ test-suite "filesystem-issues" :
+# [ run 9054_static_const_codecvt_segfault_pre_main.cpp
+# : : : <link>shared : 9054_shared ]
+# [ run 9054_static_const_codecvt_segfault_pre_main.cpp
+# : : : <link>static : 9054_static ]
+# [ run hello_filesystem.cpp
+# : : : <link>shared : hello_shared ]
+# [ run hello_filesystem.cpp
+# : : : <link>static : hello_static ]
+# [ run 9219.cpp
+# : : : <link>shared : 9219_shared ]
+# [ run 9219.cpp
+# : : : <link>static : 9219_static ]
+# [ run 10485.cpp
+# : : : <link>shared <test-info>always_show_run_output ]
+# [ run copy_file-compilation-error-2015-05-04.cpp ]
+ [ run 6638-convert_aux-fails-init-global.cpp
+ : : : <link>shared : 6638_shared ]
+ [ run 6638-convert_aux-fails-init-global.cpp
+ : : : <link>static : 6638_static ]
+
+ ;
+
diff --git a/src/boost/libs/filesystem/test/issues/boost-no-inspect b/src/boost/libs/filesystem/test/issues/boost-no-inspect
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/boost-no-inspect
diff --git a/src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp b/src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp
new file mode 100644
index 00000000..c9034d6f
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp
@@ -0,0 +1,14 @@
+// Rob Conde <rob.conde@ai-solutions.com> reports this fails
+// to compile for Boost 1.58 with g++ 4.4.7 but is OK with FC++ 2013
+
+#include "boost/filesystem/operations.hpp"
+
+void myFunc()
+{
+ using namespace boost::filesystem;
+
+ copy_option opt(copy_option::overwrite_if_exists);
+
+ copy_file(path("p1"),path("p2"),copy_option::overwrite_if_exists);
+// copy_file(path("p1"),path("p2"),opt);
+} \ No newline at end of file
diff --git a/src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp b/src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp
new file mode 100644
index 00000000..e69f9ba2
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp
@@ -0,0 +1,38 @@
+// Test program to demonstrate that Linux does not support AT_SYMLINK_NOFOLLOW
+
+// Copyright Duncan Exon Smith 2012
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Test this by running:
+//
+// rm -rf data && mkdir data && g++ -otest-fchmodat fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp && (cd data && ../test-fchmodat)
+//
+// If no assertions go off, then it looks like fchmodat is supported,
+// but AT_SYMLINK_NOFOLLOW is not supported.
+
+#include <fstream>
+#include <cassert>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <cerrno>
+
+#ifdef NDEBUG
+# error This program depends on assert() so makes no sense if NDEBUG is defined
+#endif
+
+int main(int argc, char *argv[])
+{
+ { std::ofstream file("out"); file << "contents"; }
+
+ assert(!::symlink("out", "sym"));
+
+ assert(!::fchmodat(AT_FDCWD, "out", S_IRUSR | S_IWUSR | S_IXUSR, 0));
+ assert(!::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, 0));
+
+ assert(::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, AT_SYMLINK_NOFOLLOW) == -1);
+ assert(errno == ENOTSUP);
+
+ return 0;
+}
diff --git a/src/boost/libs/filesystem/test/issues/hello_filesystem.cpp b/src/boost/libs/filesystem/test/issues/hello_filesystem.cpp
new file mode 100644
index 00000000..f98b2f71
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/hello_filesystem.cpp
@@ -0,0 +1,39 @@
+// Boost hello_filesystem.cpp --------------------------------------------------------//
+
+// Copyright Beman Dawes 2014
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+// //
+// In researching filesystem issues it is convenient to have a program that can be //
+// quickly modified to test reported problems. That's the purpose of this file and //
+// its associated Visual Studio and Boost.Build infrastructure. //
+// //
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config/warning_disable.hpp>
+
+#include <boost/filesystem.hpp>
+
+#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
+
+using std::cout;
+using std::endl;
+namespace fs = boost::filesystem;
+
+//------------------------------------ cpp_main --------------------------------------//
+
+int cpp_main(int argc, char* argv[])
+{
+ cout << "Hello, filesystem world" << endl;
+
+ BOOST_TEST(fs::exists("."));
+
+ return ::boost::report_errors();
+} // cpp_main
diff --git a/src/boost/libs/filesystem/test/issues/readme.txt b/src/boost/libs/filesystem/test/issues/readme.txt
new file mode 100644
index 00000000..cf8198e5
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/readme.txt
@@ -0,0 +1,9 @@
+This directory contains tests related to specific issues.
+
+The names are intended to indicate both the function or condition being tested
+and the issue number.
+
+-----
+Copyright Beman Dawes 2012
+Distributed under the Boost Software License, Version 1.0.
+See http://www.boost.org/LICENSE_1_0.txt
diff --git a/src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp b/src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp
new file mode 100644
index 00000000..7e7ab6c4
--- /dev/null
+++ b/src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp
@@ -0,0 +1,132 @@
+// Boost Filesystem recurse_dir_iter_test.cpp ----------------------------------------//
+
+// Copyright Beman Dawes 2014.
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+#include <boost/config/warning_disable.hpp>
+
+// See deprecated_test for tests of deprecated features
+#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
+# define BOOST_FILESYSTEM_NO_DEPRECATED
+#endif
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/operations.hpp>
+
+#include <boost/config.hpp>
+# if defined( BOOST_NO_STD_WSTRING )
+# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
+# endif
+
+#include <boost/cerrno.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/detail/lightweight_main.hpp>
+
+namespace fs = boost::filesystem;
+using boost::system::error_code;
+using boost::system::system_category;
+using boost::system::system_error;
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+
+#ifdef BOOST_WINDOWS_API
+# include <windows.h>
+#endif
+namespace
+{
+ typedef int errno_t;
+ std::string platform(BOOST_PLATFORM);
+ bool report_throws = false;
+ bool cleanup = true;
+ bool skip_long_windows_tests = false;
+ unsigned short language_id; // 0 except for Windows
+
+} // unnamed namespace
+
+//------------------------------------------------------------------------------------//
+// //
+// main //
+// //
+//------------------------------------------------------------------------------------//
+
+int cpp_main(int argc, char* argv[])
+{
+ // document state of critical macros
+#ifdef BOOST_POSIX_API
+ cout << "BOOST_POSIX_API is defined\n";
+#endif
+#ifdef BOOST_WINDOWS_API
+ cout << "BOOST_WINDOWS_API is defined\n";
+#endif
+
+ for (; argc > 1; --argc, ++argv)
+ {
+ //if (*argv[1]=='-' && *(argv[1]+1)=='t')
+ // report_throws = true;
+ //else if (*argv[1]=='-' && *(argv[1]+1)=='x')
+ // cleanup = false;
+ //else if (*argv[1]=='-' && *(argv[1]+1)=='w')
+ // skip_long_windows_tests = true;
+ }
+
+ // The choice of platform to test is made at runtime rather than compile-time
+ // so that compile errors for all platforms will be detected even though
+ // only the current platform is runtime tested.
+# if defined(BOOST_POSIX_API)
+ platform = "POSIX";
+# elif defined(BOOST_WINDOWS_API)
+ platform = "Windows";
+# if !defined(__MINGW32__) && !defined(__CYGWIN__)
+ language_id = ::GetUserDefaultUILanguage();
+# else
+ language_id = 0x0409; // Assume US English
+# endif
+# else
+# error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp
+# endif
+ cout << "API is " << platform << endl;
+ cout << "initial_path() is " << fs::initial_path() << endl;
+ fs::path ip = fs::initial_path();
+
+ for (fs::path::const_iterator it = ip.begin(); it != ip.end(); ++it)
+ {
+ if (it != ip.begin())
+ cout << ", ";
+ cout << *it;
+ }
+ cout << endl;
+
+ // From the root, walk the directory tree looking for a permissions error
+
+ fs::recursive_directory_iterator it("/");
+ fs::recursive_directory_iterator end_it;
+
+ // The increment function has an invarient that it always makes progress,
+ // so even if an error occurs this loop will eventually terminate.
+
+ while (it != end_it)
+ {
+ error_code ec;
+ fs::path init_path = it->path();
+ it.increment(ec);
+ if (ec)
+ {
+ cout << "initial path: " << init_path << endl;
+ cout << "error_code: " << ec.value() << " with msg: " << ec.message() << endl;
+ if (it != end_it)
+ cout << "post-increment path: " << it->path() << endl;
+ }
+ }
+
+ cout << "returning from main()" << endl;
+ return ::boost::report_errors();
+} // main