1 // directory_symlink_parent_resolution.cpp -------------------------------------------// 2 3 // Copyright Beman Dawes 2015 4 5 // Distributed under the Boost Software License, Version 1.0. 6 // See http://www.boost.org/LICENSE_1_0.txt 7 8 // Library home page: http://www.boost.org/libs/filesystem 9 10 #include <boost/filesystem.hpp> 11 #include <boost/filesystem/string_file.hpp> 12 #include <boost/detail/lightweight_main.hpp> 13 #include <iostream> 14 #include <string> 15 using std::cout; 16 using std::endl; 17 using namespace boost::filesystem; 18 cpp_main(int argc,char * argv[])19int cpp_main(int argc, char* argv[]) 20 { 21 # ifdef BOOST_WINDOWS_API 22 cout << "BOOST_WINDOWS_API" << endl; 23 # else 24 cout << "BOOST_POSIX_API" << endl; 25 # endif 26 27 path test_dir(current_path() / "dspr_demo"); 28 29 remove_all(test_dir); 30 create_directories(test_dir / "a/c/d"); 31 current_path(test_dir / "a"); 32 create_directory_symlink("c/d", "b"); 33 save_string_file("name.txt", "Windows"); 34 save_string_file("c/name.txt", "POSIX"); 35 current_path(test_dir); 36 std::string s; 37 load_string_file("a/b/../name.txt", s); 38 cout << s << endl; 39 40 return 0; 41 } 42