long_path_test.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // long_path_test.cpp ----------------------------------------------------------------//
  2. // Copyright Beman Dawes 2011
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // http://www.boost.org/LICENSE_1_0.txt
  5. // See http://www.boost.org/libs/btree for documentation.
  6. // See http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx
  7. #include <boost/config/warning_disable.hpp>
  8. #include <boost/filesystem.hpp>
  9. #include <iostream>
  10. #include <string>
  11. using namespace boost::filesystem;
  12. #include <boost/detail/lightweight_test.hpp>
  13. #include <boost/detail/lightweight_main.hpp>
  14. namespace
  15. {
  16. } // unnamed namespace
  17. int cpp_main(int, char*[])
  18. {
  19. std::string prefix("d:\\temp\\");
  20. std::cout << "prefix is " << prefix << '\n';
  21. const std::size_t safe_size
  22. = 260 - prefix.size() - 100; // Windows MAX_PATH is 260
  23. std::string safe_x_string(safe_size, 'x');
  24. std::string safe_y_string(safe_size, 'y');
  25. std::string path_escape("\\\\?\\");
  26. path x_p(prefix + safe_x_string);
  27. path y_p(path_escape + prefix + safe_x_string + "\\" + safe_y_string);
  28. std::cout << "x_p.native().size() is " << x_p.native().size() << '\n';
  29. std::cout << "y_p.native().size() is " << y_p.native().size() << '\n';
  30. create_directory(x_p);
  31. BOOST_TEST(exists(x_p));
  32. create_directory(y_p);
  33. BOOST_TEST(exists(y_p));
  34. //std::cout << "directory x.../y... ready for testing, where ... is " << safe_size
  35. // << " repeats of x and y, respectively\n";
  36. BOOST_TEST(exists(x_p));
  37. //remove_all(x_p);
  38. return ::boost::report_errors();
  39. }