namespace
{
- const path temp_dir(initial_path() / unique_path("op-unit_test-%%%%-%%%%-%%%%"));
-
bool cleanup = true;
void check(bool ok, const char* file, int line)
recursive_directory_iterator end;
- recursive_directory_iterator it("..");
+ recursive_directory_iterator it(".");
CHECK(!it->path().empty());
// string_file_tests ---------------------------------------------------------------//
- void string_file_tests()
+ void string_file_tests(const path& temp_dir)
{
cout << "string_file_tests..." << endl;
std::string contents("0123456789");
// //
//--------------------------------------------------------------------------------------//
-int cpp_main(int, char*[])
+int cpp_main(int argc, char* argv[])
{
// document state of critical macros
#ifdef BOOST_POSIX_API
cout << "current_path() is " << current_path().string() << endl;
+ if (argc >= 2)
+ {
+ cout << "argv[1] is '" << argv[1] << "', changing current_path() to it" << endl;
+
+ error_code ec;
+ current_path( argv[1], ec );
+
+ if (ec)
+ {
+ cout << "current_path('" << argv[1] << "') failed: " << ec << ": " << ec.message() << endl;
+ }
+
+ cout << "current_path() is " << current_path().string() << endl;
+ }
+
+ const path temp_dir(current_path() / ".." / unique_path("op-unit_test-%%%%-%%%%-%%%%"));
+ cout << "temp_dir is " << temp_dir.string() << endl;
+
create_directory(temp_dir);
file_status_test();
directory_entry_test();
directory_entry_overload_test();
error_handling_test();
- string_file_tests();
+ string_file_tests(temp_dir);
cout << unique_path() << endl;
cout << unique_path("foo-%%%%%-%%%%%-bar") << endl;