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