├── README ├── build └── Jamfile.v2 ├── doc ├── Jamfile.v2 ├── POSIX_filename_encoding.txt ├── deprecated.html ├── design.htm ├── do_list.html ├── faq.htm ├── index.htm ├── path_table.cpp ├── path_table.txt ├── portability_guide.htm ├── proposal-issues.html ├── reference.html ├── release_history.html ├── src │ ├── README │ ├── boost-no-inspect │ ├── boost_snippets.html │ ├── build.bat │ ├── filesystem-proposal.html │ ├── hoist.bat │ ├── path-portability.html │ ├── publish.bat │ ├── source.html │ └── tr2_snippets.html ├── tutorial.html ├── v3.html └── v3_design.html ├── example ├── Jamfile.v2 ├── error_demo.cpp ├── file_size.cpp ├── file_status.cpp ├── mbcopy.cpp ├── mbpath.cpp ├── mbpath.hpp ├── path_info.cpp ├── simple_ls.cpp ├── stems.cpp ├── tchar.cpp ├── test │ ├── Jamfile.v2 │ ├── bld.bat │ ├── bld.sh │ ├── setup.bat │ └── setup.sh ├── tut0.cpp ├── tut1.cpp ├── tut2.cpp ├── tut3.cpp ├── tut4.cpp ├── tut5.cpp ├── tut6a.cpp ├── tut6b.cpp ├── tut6c.cpp └── tut6d.cpp ├── include └── boost │ ├── filesystem.hpp │ └── filesystem │ ├── config.hpp │ ├── convenience.hpp │ ├── detail │ └── utf8_codecvt_facet.hpp │ ├── exception.hpp │ ├── fstream.hpp │ ├── operations.hpp │ ├── path.hpp │ └── path_traits.hpp ├── index.html ├── src ├── codecvt_error_category.cpp ├── operations.cpp ├── path.cpp ├── path_traits.cpp ├── portability.cpp ├── unique_path.cpp ├── utf8_codecvt_facet.cpp ├── windows_file_codecvt.cpp └── windows_file_codecvt.hpp ├── test ├── Jamfile.v2 ├── convenience_test.cpp ├── deprecated_test.cpp ├── design_use_cases.cpp ├── equivalent.cpp ├── fstream_test.cpp ├── large_file_support_test.cpp ├── locale_info.cpp ├── long_path_test.cpp ├── macro_default_test.cpp ├── msvc10 │ ├── common.props │ ├── convenience_test │ │ └── convenience_test.vcxproj │ ├── deprecated_test │ │ └── deprecated_test.vcxproj │ ├── exec_monitor_dll │ │ └── exec_monitor_dll.vcxproj │ ├── exec_monitor_lib │ │ └── exec_monitor_lib.vcxproj │ ├── file_status │ │ └── file_status.vcxproj │ ├── filesystem-v3.sln │ ├── filesystem_dll │ │ └── filesystem_dll.vcxproj │ ├── filesystem_lib │ │ └── filesystem_lib.vcxproj │ ├── fstream_test │ │ └── fstream_test.vcxproj │ ├── interop_dll │ │ └── interop_dll.vcxproj │ ├── locale_info │ │ └── locale_info.vcxproj │ ├── long_path_test │ │ └── long_path_test.vcxproj │ ├── macro_default_test │ │ └── macro_default_test.vcxproj │ ├── operations_test │ │ └── operations_test.vcxproj │ ├── operations_unit_test │ │ └── operations_unit_test.vcxproj │ ├── path_test │ │ └── path_test.vcxproj │ ├── path_test_static │ │ └── path_test_static.vcxproj │ ├── path_unit_test │ │ └── path_unit_test.vcxproj │ ├── stems │ │ └── stems.vcxproj │ ├── system_dll │ │ └── system_dll.vcxproj │ ├── system_lib │ │ └── system_lib.vcxproj │ ├── tut1 │ │ └── tut1.vcxproj │ ├── tut2 │ │ └── tut2.vcxproj │ ├── tut3 │ │ └── tut3.vcxproj │ ├── tut4 │ │ └── tut4.vcxproj │ ├── tut5 │ │ └── tut5.vcxproj │ ├── tut6a │ │ └── tut6a.vcxproj │ ├── tut6b │ │ └── tut6b.vcxproj │ ├── tut6c │ │ └── tut6c.vcxproj │ └── windows_attributes │ │ └── windows_attributes.vcxproj ├── operations_test.cpp ├── operations_unit_test.cpp ├── path_test.cpp ├── path_unit_test.cpp ├── sample_test.cpp ├── test_codecvt.hpp └── windows_attributes.cpp └── tools ├── backup.bat └── exclude.txt /README: -------------------------------------------------------------------------------- 1 | filesystem-proposal-mods 2 | ======================== 3 | 4 | Boost Filesystem Library with modifications for the C++ standards committee proposal 5 | 6 | To experiment (Windows): 7 | 8 | Export boost subversion repo, say to trunk-ex 9 | pushd trunk-ex 10 | delete boost/filesystem.hpp, boost/filesystem, libs/filesystem 11 | git clone git://github.com/Beman/filesystem-proposal.git libs/filesystem 12 | pushd boost 13 | mklink filesystem.hpp ..\libs\filesystem\include\boost\filesystem.hpp 14 | mklink cxx11_char_types.hpp ..\libs\filesystem\include\boost\cxx11_char_types.hpp 15 | mklink /d filesystem ..\libs\filesystem\include\boost\filesystem 16 | popd 17 | popd 18 | bootstrap 19 | b2 20 | -------------------------------------------------------------------------------- /build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost Filesystem Library Build Jamfile 2 | 3 | # (C) Copyright Beman Dawes 2002-2006 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # See www.boost.org/LICENSE_1_0.txt 6 | 7 | # See library home page at http://www.boost.org/libs/filesystem 8 | 9 | project boost/filesystem 10 | : source-location ../src 11 | : usage-requirements # pass these requirement to dependents (i.e. users) 12 | shared:BOOST_FILESYSTEM_DYN_LINK=1 13 | static:BOOST_FILESYSTEM_STATIC_LINK=1 14 | ; 15 | 16 | SOURCES = 17 | codecvt_error_category 18 | operations 19 | path 20 | path_traits 21 | portability 22 | unique_path 23 | utf8_codecvt_facet 24 | windows_file_codecvt 25 | ; 26 | 27 | lib boost_filesystem 28 | : $(SOURCES).cpp ../../system/build//boost_system 29 | ../../interop/build//boost_interop 30 | ../../chrono/build//boost_chrono 31 | : shared:BOOST_FILESYSTEM_DYN_LINK=1 32 | static:BOOST_FILESYSTEM_STATIC_LINK=1 33 | : 34 | : # Boost.Filesystem uses some of Boost.System functions in inlined/templated 35 | # functions, so clients that use Boost.Filesystem will have direct references 36 | # to Boost.System symbols. On Windows, Darwin, and some other platforms, this 37 | # means those clients have to be directly linked to Boost.System. For static 38 | # linking this happens anyway, but for shared we need to make it happen. Since 39 | # doing so is harmless even when not needed, we do it for all platforms. 40 | shared:../../system/build//boost_system 41 | shared:../../chrono/build//boost_chrono 42 | ; 43 | 44 | boost-install boost_filesystem ; 45 | -------------------------------------------------------------------------------- /doc/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost Filesystem Library Example Jamfile 2 | 3 | # Copyright Beman Dawes 2010 4 | 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # See www.boost.org/LICENSE_1_0.txt 7 | 8 | # Library home page: http://www.boost.org/libs/filesystem 9 | 10 | project 11 | : requirements 12 | /boost/filesystem//boost_filesystem 13 | /boost/system//boost_system 14 | msvc:on 15 | static 16 | ; 17 | 18 | exe path_table : path_table.cpp ; 19 | install path_table-copy : path_table : . ; -------------------------------------------------------------------------------- /doc/POSIX_filename_encoding.txt: -------------------------------------------------------------------------------- 1 | http://www.linuxfromscratch.org/blfs/view/svn/introduction/locale-issues.html 2 | 3 | "The POSIX standard mandates that the filename encoding is the encoding implied by the current LC_CTYPE locale category." 4 | 5 | ------- 6 | 7 | http://mail.nl.linux.org/linux-utf8/2001-02/msg00103.html 8 | 9 | From: Markus Kuhn 10 | 11 | Tom Tromey wrote on 2001-02-05 00:36 UTC: 12 | > Kai> IMAO, a *real* filesystem should use some encoding of ISO 10646 - 13 | > Kai> UTF-8, UTF-16, or UTF-32 are all viable options. The same should 14 | > Kai> be true for the kernel filename interfaces. 15 | > 16 | > I like this, but what should I do right now? 17 | 18 | The POSIX kernel file system interface is engraved into stone and 19 | extremely unlikely to change. File names are arbitrary binary strings, 20 | with only the '/' and '\0' bytes having any special semantics. You can 21 | use arbitrary coded character sets on it as long as they do not 22 | introduce '/' and '\0' bytes spuriously. Writers and readers have to 23 | somehow agree on what encoding to use and the only really practical way 24 | is to use the same encoding on all systems that share files. Eventually, 25 | everyone will be using UTF-8 for file names on POSIX systems. Right now, 26 | I would recommend users to use only ASCII for filenames, as this is 27 | already UTF-8 and therefore simplifies migration. Using the ISO 8859, 28 | JIS, etc. filenames should soon be considered deprecated practice. 29 | 30 | > I work on libgcj, the runtime component of gcj, the Java front end to 31 | > GCC. In libgcj of course we use UCS-2 everywhere, since that is what 32 | > Java does. Currently, for Unixy systems, we assume that all file 33 | > names are UTF-8. 34 | 35 | The best solution is to assume that the file names are in the 36 | locale-specific multi-byte encoding. Simply use mbrtowc and wcrtomb to 37 | convert between Unicode and the locale-dependent multi-byte encoding 38 | used in file names and text files if the ISO C 99 symbol 39 | __STDC_ISO_10646__ is defined (which guarantees that wchar_t = UCS). On 40 | Linux, this has been the case since glibc 2.2. 41 | 42 | > (Actually, we do something notably worse, which is 43 | > assume that file names are Java-style UTF-8, with the weird encoding 44 | > for \u0000.) 45 | 46 | \u0000 = NUL was never a character allowed in filenames under POSIX. 47 | Raise an exception if someone tries to use it in a filename. Problem 48 | solved. 49 | 50 | I never understood, why Java found it necessary to introduce two 51 | distinct ASCII NUL characters. 52 | 53 | ------ 54 | 55 | Interesting idea. Use iconv to create shift-jis or other mbcs test cases. 56 | -------------------------------------------------------------------------------- /doc/design.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/design.htm -------------------------------------------------------------------------------- /doc/do_list.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/do_list.html -------------------------------------------------------------------------------- /doc/faq.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/faq.htm -------------------------------------------------------------------------------- /doc/path_table.txt: -------------------------------------------------------------------------------- 1 | # Paths for the reference.html Path Decomposition Table 2 | # 3 | # This is the input file for path_table, which generates the actual html 4 | # 5 | # Copyright Beman Dawes 2010 6 | # 7 | # Distributed under the Boost Software License, Version 1.0. 8 | # See www.boost.org/LICENSE_1_0.txt 9 | # 10 | # Note that an empty line is treated as input rather than as a comment 11 | 12 | . 13 | .. 14 | foo 15 | / 16 | /foo 17 | foo/ 18 | /foo/ 19 | foo/bar 20 | /foo/bar 21 | //net 22 | //net/foo 23 | ///foo/// 24 | ///foo///bar 25 | /. 26 | ./ 27 | /.. 28 | ../ 29 | foo/. 30 | foo/.. 31 | foo/./ 32 | foo/./bar 33 | foo/.. 34 | foo/../ 35 | foo/../bar 36 | c: 37 | c:/ 38 | c:foo 39 | c:/foo 40 | c:foo/ 41 | c:/foo/ 42 | c:/foo/bar 43 | prn: 44 | c:\ 45 | c:foo 46 | c:\foo 47 | c:foo\ 48 | c:\foo\ 49 | c:\foo/ 50 | c:/foo\bar 51 | -------------------------------------------------------------------------------- /doc/portability_guide.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/portability_guide.htm -------------------------------------------------------------------------------- /doc/reference.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/reference.html -------------------------------------------------------------------------------- /doc/release_history.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/release_history.html -------------------------------------------------------------------------------- /doc/src/README: -------------------------------------------------------------------------------- 1 | This directory contains the source files used to generate the Filesystem library 2 | reference documentation and the TR2 filesystem proposal. The generated HTML files 3 | contain much common material that would be difficult to keep in sync if maintained 4 | as separate files. 5 | 6 | Generation is performed by the Minimal Macro Processor, available from 7 | https://github.com/Beman/mmp 8 | 9 | ------------ 10 | 11 | Copyright Beman Dawes 2012 12 | 13 | Distributed under the Boost Software Licence Version 1.0. 14 | See http://www.boost.org/LICENSE_1_0.txt 15 | -------------------------------------------------------------------------------- /doc/src/boost-no-inspect: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/src/boost-no-inspect -------------------------------------------------------------------------------- /doc/src/boost_snippets.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/src/boost_snippets.html -------------------------------------------------------------------------------- /doc/src/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright Beman Dawes 2012 3 | rem Distributed under the Boost Software License, Version 1.0. 4 | 5 | echo Generating LWG filesystem-proposal.html... 6 | del filesystem-proposal.html 2>nul 7 | 8 | rem ' dir="ltr"' messes up the section number generation 9 | chg boost_snippets.html " dir=\qltr\q" "" 10 | chg tr2_snippets.html " dir=\qltr\q" "" 11 | chg source.html " dir=\qltr\q" "" 12 | 13 | mmp TARGET=TR2 source.html temp.html 14 | html_section_numbers filesystem-proposal.html 15 | toc -x filesystem-proposal.html filesystem-proposal.toc 16 | echo Fresh table-of-contents generated in filesystem-proposal.toc. 17 | echo Hand edit into source files if desired. 18 | type \bgd\util\crnl.txt 19 | 20 | echo Generating Boost reference.html... 21 | del reference.html 2>nul 22 | mmp TARGET=BOOST source.html reference.html 23 | toc -x reference.html reference.toc 24 | echo Fresh table-of-contents generated in reference.toc. 25 | echo Hand edit into source files if desired. 26 | type \bgd\util\crnl.txt 27 | 28 | echo Run "hoist" to hoist reference.html to doc directory 29 | -------------------------------------------------------------------------------- /doc/src/hoist.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright Beman Dawes 2012 3 | rem Distributed under the Boost Software License, Version 1.0. 4 | copy /y reference.html .. 5 | echo reference.html copied to .. 6 | -------------------------------------------------------------------------------- /doc/src/publish.bat: -------------------------------------------------------------------------------- 1 | copy /y filesystem-proposal.html D:\filesystem-proposal\index.html 2 | pushd D:\filesystem-proposal 3 | call git commit -a -m "auto commit" 4 | call git push origin gh-pages 5 | popd 6 | -------------------------------------------------------------------------------- /doc/tutorial.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/tutorial.html -------------------------------------------------------------------------------- /doc/v3.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/filesystem-proposal/477287caabc57ebe04e5f77cd0707b70d11925db/doc/v3.html -------------------------------------------------------------------------------- /example/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost Filesystem Library Example Jamfile 2 | 3 | # (C) Copyright Vladimir Prus 2003 4 | 5 | # Distributed under the Boost Software License, Version 1.0. 6 | # See www.boost.org/LICENSE_1_0.txt 7 | 8 | # Library home page: http://www.boost.org/libs/filesystem 9 | 10 | project 11 | : requirements 12 | /boost/filesystem//boost_filesystem 13 | /boost/system//boost_system 14 | msvc:on 15 | static 16 | ; 17 | 18 | exe tut0 : tut0.cpp ; 19 | exe tut1 : tut1.cpp ; 20 | exe tut2 : tut2.cpp ; 21 | exe tut3 : tut3.cpp ; 22 | exe tut4 : tut4.cpp ; 23 | exe tut5 : tut5.cpp ; 24 | exe path_info : path_info.cpp ; 25 | exe file_status : file_status.cpp ; 26 | 27 | install bin : file_status ; #invoke via "bjam", not "bjam install" 28 | -------------------------------------------------------------------------------- /example/file_size.cpp: -------------------------------------------------------------------------------- 1 | // file_size program -------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes, 2004 4 | 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // See http://www.boost.org/libs/filesystem for documentation. 10 | 11 | #include 12 | #include 13 | 14 | namespace fs = boost::filesystem; 15 | 16 | int main( int argc, char* argv[] ) 17 | { 18 | 19 | if ( argc != 2 ) 20 | { 21 | std::cout << "Usage: file_size path\n"; 22 | return 1; 23 | } 24 | 25 | std::cout << "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n'; 26 | 27 | fs::path p( argv[1] ); 28 | 29 | if ( !fs::exists( p ) ) 30 | { 31 | std::cout << "not found: " << argv[1] << std::endl; 32 | return 1; 33 | } 34 | 35 | if ( !fs::is_regular( p ) ) 36 | { 37 | std::cout << "not a regular file: " << argv[1] << std::endl; 38 | return 1; 39 | } 40 | 41 | std::cout << "size of " << argv[1] << " is " << fs::file_size( p ) 42 | << std::endl; 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /example/file_status.cpp: -------------------------------------------------------------------------------- 1 | // status.cpp ------------------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2011 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 11 | #include 12 | #include 13 | #include 14 | 15 | #ifndef BOOST_LIGHTWEIGHT_MAIN 16 | # include 17 | #else 18 | # include 19 | #endif 20 | 21 | using std::cout; using std::endl; 22 | using namespace boost::filesystem; 23 | 24 | namespace 25 | { 26 | path p; 27 | 28 | void print_boost_macros() 29 | { 30 | std::cout << "Boost " 31 | << BOOST_VERSION / 100000 << '.' 32 | << BOOST_VERSION / 100 % 1000 << '.' 33 | << BOOST_VERSION % 100 << ", " 34 | # ifndef _WIN64 35 | << BOOST_COMPILER << ", " 36 | # else 37 | << BOOST_COMPILER << " with _WIN64 defined, " 38 | # endif 39 | << BOOST_STDLIB << ", " 40 | << BOOST_PLATFORM 41 | << std::endl; 42 | } 43 | 44 | const char* file_type_tab[] = 45 | { "status_error", "file_not_found", "regular_file", "directory_file", 46 | "symlink_file", "block_file", "character_file", "fifo_file", "socket_file", 47 | "type_unknown" 48 | }; 49 | 50 | const char* file_type_c_str(BOOST_SCOPED_ENUM(file_type) t) 51 | { 52 | return file_type_tab[static_cast(t)]; 53 | } 54 | 55 | void show_status(file_status s, boost::system::error_code ec) 56 | { 57 | boost::system::error_condition econd; 58 | 59 | if (ec) 60 | { 61 | econd = ec.default_error_condition(); 62 | cout << "sets ec to indicate an error:\n" 63 | << " ec.value() is " << ec.value() << '\n' 64 | << " ec.message() is \"" << ec.message() << "\"\n" 65 | << " ec.default_error_condition().value() is " << econd.value() << '\n' 66 | << " ec.default_error_condition().message() is \"" << econd.message() << "\"\n"; 67 | } 68 | else 69 | cout << "clears ec.\n"; 70 | 71 | cout << "s.type() is " << static_cast(s.type()) 72 | << ", which is defined as \"" << file_type_c_str(s.type()) << "\"\n"; 73 | 74 | cout << "exists(s) is " << (exists(s) ? "true" : "false") << "\n"; 75 | cout << "status_known(s) is " << (status_known(s) ? "true" : "false") << "\n"; 76 | cout << "is_regular_file(s) is " << (is_regular_file(s) ? "true" : "false") << "\n"; 77 | cout << "is_directory(s) is " << (is_directory(s) ? "true" : "false") << "\n"; 78 | cout << "is_other(s) is " << (is_other(s) ? "true" : "false") << "\n"; 79 | cout << "is_symlink(s) is " << (is_symlink(s) ? "true" : "false") << "\n"; 80 | } 81 | 82 | void try_exists() 83 | { 84 | cout << "\nexists(" << p << ") "; 85 | try 86 | { 87 | bool result = exists(p); 88 | cout << "is " << (result ? "true" : "false") << "\n"; 89 | } 90 | catch (const filesystem_error& ex) 91 | { 92 | cout << "throws a filesystem_error exception: " << ex.what() << "\n"; 93 | } 94 | } 95 | 96 | } 97 | 98 | int cpp_main(int argc, char* argv[]) 99 | { 100 | print_boost_macros(); 101 | 102 | if (argc < 2) 103 | { 104 | std::cout << "Usage: file_status \n"; 105 | p = argv[0]; 106 | } 107 | else 108 | p = argv[1]; 109 | 110 | boost::system::error_code ec; 111 | file_status s = status(p, ec); 112 | cout << "\nfile_status s = status(" << p << ", ec) "; 113 | show_status(s, ec); 114 | 115 | s = symlink_status(p, ec); 116 | cout << "\nfile_status s = symlink_status(" << p << ", ec) "; 117 | show_status(s, ec); 118 | 119 | try_exists(); 120 | 121 | return 0; 122 | } 123 | -------------------------------------------------------------------------------- /example/mbcopy.cpp: -------------------------------------------------------------------------------- 1 | // Boost.Filesystem mbcopy.cpp ---------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2005 4 | 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // Copy the files in a directory, using mbpath to represent the new file names 10 | // See http://../doc/path.htm#mbpath for more information 11 | 12 | // See deprecated_test for tests of deprecated features 13 | #define BOOST_FILESYSTEM_NO_DEPRECATED 14 | 15 | #include 16 | # ifdef BOOST_FILESYSTEM_NARROW_ONLY 17 | # error This compiler or standard library does not support wide-character strings or paths 18 | # endif 19 | 20 | #include "mbpath.hpp" 21 | #include 22 | #include 23 | #include 24 | #include "../src/utf8_codecvt_facet.hpp" 25 | 26 | namespace fs = boost::filesystem; 27 | 28 | namespace 29 | { 30 | // we can't use boost::filesystem::copy_file() because the argument types 31 | // differ, so provide a not-very-smart replacement. 32 | 33 | void copy_file( const fs::wpath & from, const user::mbpath & to ) 34 | { 35 | fs::ifstream from_file( from, std::ios_base::in | std::ios_base::binary ); 36 | if ( !from_file ) { std::cout << "input open failed\n"; return; } 37 | 38 | fs::ofstream to_file( to, std::ios_base::out | std::ios_base::binary ); 39 | if ( !to_file ) { std::cout << "output open failed\n"; return; } 40 | 41 | char c; 42 | while ( from_file.get(c) ) 43 | { 44 | to_file.put(c); 45 | if ( to_file.fail() ) { std::cout << "write error\n"; return; } 46 | } 47 | 48 | if ( !from_file.eof() ) { std::cout << "read error\n"; } 49 | } 50 | } 51 | 52 | int main( int argc, char * argv[] ) 53 | { 54 | if ( argc != 2 ) 55 | { 56 | std::cout << "Copy files in the current directory to a target directory\n" 57 | << "Usage: mbcopy \n"; 58 | return 1; 59 | } 60 | 61 | // For encoding, use Boost UTF-8 codecvt 62 | std::locale global_loc = std::locale(); 63 | std::locale loc( global_loc, new fs::detail::utf8_codecvt_facet ); 64 | user::mbpath_traits::imbue( loc ); 65 | 66 | std::string target_string( argv[1] ); 67 | user::mbpath target_dir( user::mbpath_traits::to_internal( target_string ) ); 68 | 69 | if ( !fs::is_directory( target_dir ) ) 70 | { 71 | std::cout << "Error: " << argv[1] << " is not a directory\n"; 72 | return 1; 73 | } 74 | 75 | for ( fs::wdirectory_iterator it( L"." ); 76 | it != fs::wdirectory_iterator(); ++it ) 77 | { 78 | if ( fs::is_regular_file(it->status()) ) 79 | { 80 | copy_file( *it, target_dir / it->path().filename() ); 81 | } 82 | } 83 | 84 | return 0; 85 | } 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /example/mbpath.cpp: -------------------------------------------------------------------------------- 1 | // Boost.Filesystem mbpath.cpp ---------------------------------------------// 2 | 3 | // (c) Copyright Beman Dawes 2005 4 | 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // See Boost.Filesystem home page at http://www.boost.org/libs/filesystem 10 | 11 | #include 12 | # ifdef BOOST_FILESYSTEM_NARROW_ONLY 13 | # error This compiler or standard library does not support wide-character strings or paths 14 | # endif 15 | 16 | #include "mbpath.hpp" 17 | #include 18 | #include 19 | 20 | namespace fs = boost::filesystem; 21 | 22 | namespace 23 | { 24 | // ISO C calls this "the locale-specific native environment": 25 | std::locale loc(""); 26 | 27 | const std::codecvt * 28 | cvt( &std::use_facet > 29 | ( loc ) ); 30 | } 31 | 32 | namespace user 33 | { 34 | mbpath_traits::external_string_type 35 | mbpath_traits::to_external( const mbpath & ph, 36 | const internal_string_type & src ) 37 | { 38 | std::size_t work_size( cvt->max_length() * (src.size()+1) ); 39 | boost::scoped_array work( new char[ work_size ] ); 40 | std::mbstate_t state; 41 | const internal_string_type::value_type * from_next; 42 | external_string_type::value_type * to_next; 43 | if ( cvt->out( 44 | state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), 45 | work.get()+work_size, to_next ) != std::codecvt_base::ok ) 46 | boost::throw_exception >( 47 | fs::basic_filesystem_error( 48 | "user::mbpath::to_external conversion error", 49 | ph, boost::system::error_code( EINVAL, boost::system::errno_ecat ) ) ); 50 | *to_next = '\0'; 51 | return external_string_type( work.get() ); 52 | } 53 | 54 | mbpath_traits::internal_string_type 55 | mbpath_traits::to_internal( const external_string_type & src ) 56 | { 57 | std::size_t work_size( src.size()+1 ); 58 | boost::scoped_array work( new wchar_t[ work_size ] ); 59 | std::mbstate_t state; 60 | const external_string_type::value_type * from_next; 61 | internal_string_type::value_type * to_next; 62 | if ( cvt->in( 63 | state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), 64 | work.get()+work_size, to_next ) != std::codecvt_base::ok ) 65 | boost::throw_exception >( 66 | fs::basic_filesystem_error( 67 | "user::mbpath::to_internal conversion error", 68 | boost::system::error_code( EINVAL, boost::system::errno_ecat ) ) ); 69 | *to_next = L'\0'; 70 | return internal_string_type( work.get() ); 71 | } 72 | 73 | void mbpath_traits::imbue( const std::locale & new_loc ) 74 | { 75 | loc = new_loc; 76 | cvt = &std::use_facet 77 | >( loc ); 78 | } 79 | 80 | } // namespace user 81 | -------------------------------------------------------------------------------- /example/mbpath.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Filesystem mbpath.hpp ---------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2005 4 | 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // Encodes wide character paths as MBCS 10 | // See http://../doc/path.htm#mbpath for more information 11 | 12 | #include 13 | #include // for std::mbstate_t 14 | #include 15 | #include 16 | 17 | namespace user 18 | { 19 | struct mbpath_traits; 20 | 21 | typedef boost::filesystem::basic_path mbpath; 22 | 23 | struct mbpath_traits 24 | { 25 | typedef std::wstring internal_string_type; 26 | typedef std::string external_string_type; 27 | 28 | static external_string_type to_external( const mbpath & ph, 29 | const internal_string_type & src ); 30 | 31 | static internal_string_type to_internal( const external_string_type & src ); 32 | 33 | static void imbue( const std::locale & loc ); 34 | }; 35 | } // namespace user 36 | 37 | namespace boost 38 | { 39 | namespace filesystem 40 | { 41 | template<> struct is_basic_path 42 | { static const bool value = true; }; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /example/path_info.cpp: -------------------------------------------------------------------------------- 1 | // path_info.cpp ---------------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 11 | #include 12 | using namespace std; 13 | using namespace boost::filesystem; 14 | 15 | const char * say_what(bool b) { return b ? "true" : "false"; } 16 | 17 | int main(int argc, char* argv[]) 18 | { 19 | if (argc < 2) 20 | { 21 | cout << "Usage: path_info path-portion...\n" 22 | "Example: path_info foo/bar baz\n" 23 | # ifdef BOOST_POSIX_API 24 | " would report info about the composed path foo/bar/baz\n"; 25 | # else // BOOST_WINDOWS_API 26 | " would report info about the composed path foo/bar\\baz\n"; 27 | # endif 28 | return 1; 29 | } 30 | 31 | path p; // compose a path from the command line arguments 32 | 33 | for (; argc > 1; --argc, ++argv) 34 | p /= argv[1]; 35 | 36 | cout << "\ncomposed path:\n"; 37 | cout << " cout << -------------: " << p << "\n"; 38 | cout << " make_preferred()----------: " << path(p).make_preferred() << "\n"; 39 | 40 | cout << "\nelements:\n"; 41 | 42 | for (path::iterator it(p.begin()), it_end(p.end()); it != it_end; ++it) 43 | cout << " " << *it << '\n'; 44 | 45 | cout << "\nobservers, native format:" << endl; 46 | # ifdef BOOST_POSIX_API 47 | cout << " native()-------------: " << p.native() << endl; 48 | cout << " c_str()--------------: " << p.c_str() << endl; 49 | # else // BOOST_WINDOWS_API 50 | wcout << L" native()-------------: " << p.native() << endl; 51 | wcout << L" c_str()--------------: " << p.c_str() << endl; 52 | # endif 53 | cout << " string()-------------: " << p.string() << endl; 54 | wcout << L" wstring()------------: " << p.wstring() << endl; 55 | 56 | cout << "\nobservers, generic format:\n"; 57 | cout << " generic_string()-----: " << p.generic_string() << endl; 58 | wcout << L" generic_wstring()----: " << p.generic_wstring() << endl; 59 | 60 | cout << "\ndecomposition:\n"; 61 | cout << " root_name()----------: " << p.root_name() << '\n'; 62 | cout << " root_directory()-----: " << p.root_directory() << '\n'; 63 | cout << " root_path()----------: " << p.root_path() << '\n'; 64 | cout << " relative_path()------: " << p.relative_path() << '\n'; 65 | cout << " parent_path()--------: " << p.parent_path() << '\n'; 66 | cout << " filename()-----------: " << p.filename() << '\n'; 67 | cout << " stem()---------------: " << p.stem() << '\n'; 68 | cout << " extension()----------: " << p.extension() << '\n'; 69 | 70 | cout << "\nquery:\n"; 71 | cout << " empty()--------------: " << say_what(p.empty()) << '\n'; 72 | cout << " is_absolute()--------: " << say_what(p.is_absolute()) << '\n'; 73 | cout << " has_root_name()------: " << say_what(p.has_root_name()) << '\n'; 74 | cout << " has_root_directory()-: " << say_what(p.has_root_directory()) << '\n'; 75 | cout << " has_root_path()------: " << say_what(p.has_root_path()) << '\n'; 76 | cout << " has_relative_path()--: " << say_what(p.has_relative_path()) << '\n'; 77 | cout << " has_parent_path()----: " << say_what(p.has_parent_path()) << '\n'; 78 | cout << " has_filename()-------: " << say_what(p.has_filename()) << '\n'; 79 | cout << " has_stem()-----------: " << say_what(p.has_stem()) << '\n'; 80 | cout << " has_extension()------: " << say_what(p.has_extension()) << '\n'; 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /example/simple_ls.cpp: -------------------------------------------------------------------------------- 1 | // simple_ls program -------------------------------------------------------// 2 | 3 | // Copyright Jeff Garland and Beman Dawes, 2002 4 | 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // See http://www.boost.org/libs/filesystem for documentation. 10 | 11 | #define BOOST_FILESYSTEM_VERSION 3 12 | 13 | // As an example program, we don't want to use any deprecated features 14 | #ifndef BOOST_FILESYSTEM_NO_DEPRECATED 15 | # define BOOST_FILESYSTEM_NO_DEPRECATED 16 | #endif 17 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 18 | # define BOOST_SYSTEM_NO_DEPRECATED 19 | #endif 20 | 21 | #include "boost/filesystem/operations.hpp" 22 | #include "boost/filesystem/path.hpp" 23 | #include "boost/progress.hpp" 24 | #include 25 | 26 | namespace fs = boost::filesystem; 27 | 28 | int main(int argc, char* argv[]) 29 | { 30 | fs::path p(fs::current_path()); 31 | 32 | if (argc > 1) 33 | p = fs::system_complete(argv[1]); 34 | else 35 | std::cout << "\nusage: simple_ls [path]" << std::endl; 36 | 37 | unsigned long file_count = 0; 38 | unsigned long dir_count = 0; 39 | unsigned long other_count = 0; 40 | unsigned long err_count = 0; 41 | 42 | if (!fs::exists(p)) 43 | { 44 | std::cout << "\nNot found: " << p << std::endl; 45 | return 1; 46 | } 47 | 48 | if (fs::is_directory(p)) 49 | { 50 | std::cout << "\nIn directory: " << p << "\n\n"; 51 | fs::directory_iterator end_iter; 52 | for (fs::directory_iterator dir_itr(p); 53 | dir_itr != end_iter; 54 | ++dir_itr) 55 | { 56 | try 57 | { 58 | if (fs::is_directory(dir_itr->status())) 59 | { 60 | ++dir_count; 61 | std::cout << dir_itr->path().filename() << " [directory]\n"; 62 | } 63 | else if (fs::is_regular_file(dir_itr->status())) 64 | { 65 | ++file_count; 66 | std::cout << dir_itr->path().filename() << "\n"; 67 | } 68 | else 69 | { 70 | ++other_count; 71 | std::cout << dir_itr->path().filename() << " [other]\n"; 72 | } 73 | 74 | } 75 | catch (const std::exception & ex) 76 | { 77 | ++err_count; 78 | std::cout << dir_itr->path().filename() << " " << ex.what() << std::endl; 79 | } 80 | } 81 | std::cout << "\n" << file_count << " files\n" 82 | << dir_count << " directories\n" 83 | << other_count << " others\n" 84 | << err_count << " errors\n"; 85 | } 86 | else // must be a file 87 | { 88 | std::cout << "\nFound: " << p << "\n"; 89 | } 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /example/stems.cpp: -------------------------------------------------------------------------------- 1 | // filesystem example stems.cpp ------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2011 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 11 | #include 12 | 13 | int main(int argc, char* argv[]) 14 | { 15 | if (argc < 2) 16 | { 17 | std::cout << "Usage: stems \n"; 18 | return 1; 19 | } 20 | 21 | boost::filesystem::path p(argv[1]), name(p.filename()); 22 | 23 | for(;;) 24 | { 25 | std::cout << "filename " << name << " has stem " << name.stem() 26 | << " and extension " << name.extension() << "\n"; 27 | if (name.stem().empty() || name.extension().empty()) 28 | return 0; 29 | name = name.stem(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /example/tchar.cpp: -------------------------------------------------------------------------------- 1 | // Example use of Microsoft TCHAR ----------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2008 4 | 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // See http://www.boost.org/LICENSE_1_0.txt 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace fs = boost::filesystem; 16 | 17 | typedef std::basic_string tstring; 18 | 19 | void func( const fs::path & p ) 20 | { 21 | assert( fs::exists( p ) ); 22 | } 23 | 24 | int main() 25 | { 26 | // get a path that is known to exist 27 | fs::path cp = fs::current_path(); 28 | 29 | // demo: get tstring from the path 30 | tstring cp_as_tstring = cp.string(); 31 | 32 | // demo: pass tstring to filesystem function taking path 33 | assert( fs::exists( cp_as_tstring ) ); 34 | 35 | // demo: pass tstring to user function taking path 36 | func( cp_as_tstring ); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /example/test/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost Filesystem Library Tutorial Jamfile 2 | 3 | # (C) Copyright Beman Dawes 2010 4 | # (C) Copyright Vladimir Prus 2003 5 | 6 | # Distributed under the Boost Software License, Version 1.0. 7 | # See www.boost.org/LICENSE_1_0.txt 8 | 9 | # Library home page: http://www.boost.org/libs/filesystem 10 | 11 | project 12 | : requirements 13 | /boost/filesystem//boost_filesystem 14 | /boost/system//boost_system 15 | msvc:on 16 | ; 17 | 18 | exe tut1 : tut1.cpp ; 19 | exe tut2 : tut2.cpp ; 20 | exe tut3 : tut3.cpp ; 21 | exe tut4 : tut4.cpp ; 22 | exe tut5 : tut5.cpp ; 23 | exe path_info : path_info.cpp ; 24 | 25 | install tut1-copy : tut1 : . ; 26 | install tut2-copy : tut2 : . ; 27 | install tut3-copy : tut3 : . ; 28 | install tut4-copy : tut4 : . ; 29 | install tut5-copy : tut5 : . ; 30 | install path_info-copy : path_info : . ; 31 | 32 | -------------------------------------------------------------------------------- /example/test/bld.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright Beman Dawes, 2010 3 | rem Distributed under the Boost Software License, Version 1.0. 4 | rem See www.boost.org/LICENSE_1_0.txt 5 | 6 | bjam %* >bjam.log 7 | find "error" bjam.log 8 | grep "error" nul 7 | copy /y ..\tut2.cpp >nul 8 | copy /y ..\tut3.cpp >nul 9 | copy /y ..\tut4.cpp >nul 10 | copy /y ..\tut5.cpp >nul 11 | copy /y ..\path_info.cpp >nul 12 | del *.exe 2>nul 13 | del *.pdb 2>nul 14 | -------------------------------------------------------------------------------- /example/test/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright Beman Dawes, 2010 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # See www.boost.org/LICENSE_1_0.txt 6 | 7 | cp ../tut1.cpp . 8 | cp ../tut2.cpp . 9 | cp ../tut3.cpp . 10 | cp ../tut4.cpp . 11 | cp ../tut5.cpp . 12 | cp ../path_info.cpp . 13 | rm tut1 2>~/junk 14 | rm tut2 2>~/junk 15 | rm tut3 2>~/junk 16 | rm tut4 2>~/junk 17 | rm tut5 2>~/junk 18 | rm path_info 2>~/junk 19 | 20 | -------------------------------------------------------------------------------- /example/tut0.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut0.cpp ---------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 11 | #include 12 | namespace fs = boost::filesystem; 13 | 14 | int main(int argc, char* argv[]) 15 | { 16 | if (argc < 2) 17 | { 18 | std::cout << "Usage: tut0 path\n"; 19 | return 1; 20 | } 21 | 22 | std::cout << argv[1] << '\n'; 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /example/tut1.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut1.cpp ---------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 11 | #include 12 | using namespace boost::filesystem; 13 | 14 | int main(int argc, char* argv[]) 15 | { 16 | if (argc < 2) 17 | { 18 | std::cout << "Usage: tut1 path\n"; 19 | return 1; 20 | } 21 | std::cout << argv[1] << " " << file_size(argv[1]) << '\n'; 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /example/tut2.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut2.cpp ---------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 11 | #include 12 | using namespace std; 13 | using namespace boost::filesystem; 14 | 15 | int main(int argc, char* argv[]) 16 | { 17 | if (argc < 2) 18 | { 19 | cout << "Usage: tut2 path\n"; 20 | return 1; 21 | } 22 | 23 | path p (argv[1]); // p reads clearer than argv[1] in the following code 24 | 25 | if (exists(p)) // does p actually exist? 26 | { 27 | if (is_regular_file(p)) // is p a regular file? 28 | cout << p << " size is " << file_size(p) << '\n'; 29 | 30 | else if (is_directory(p)) // is p a directory? 31 | cout << p << " is a directory\n"; 32 | 33 | else 34 | cout << p << " exists, but is neither a regular file nor a directory\n"; 35 | } 36 | else 37 | cout << p << " does not exist\n"; 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /example/tut3.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut3.cpp ---------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 11 | #include 12 | #include 13 | #include 14 | using namespace std; 15 | using namespace boost::filesystem; 16 | 17 | int main(int argc, char* argv[]) 18 | { 19 | if (argc < 2) 20 | { 21 | cout << "Usage: tut3 path\n"; 22 | return 1; 23 | } 24 | 25 | path p (argv[1]); // p reads clearer than argv[1] in the following code 26 | 27 | try 28 | { 29 | if (exists(p)) // does p actually exist? 30 | { 31 | if (is_regular_file(p)) // is p a regular file? 32 | cout << p << " size is " << file_size(p) << '\n'; 33 | 34 | else if (is_directory(p)) // is p a directory? 35 | { 36 | cout << p << " is a directory containing:\n"; 37 | 38 | copy(directory_iterator(p), directory_iterator(), // directory_iterator::value_type 39 | ostream_iterator(cout, "\n")); // is directory_entry, which is 40 | // converted to a path by the 41 | // path stream inserter 42 | } 43 | else 44 | cout << p << " exists, but is neither a regular file nor a directory\n"; 45 | } 46 | else 47 | cout << p << " does not exist\n"; 48 | } 49 | 50 | catch (const filesystem_error& ex) 51 | { 52 | cout << ex.what() << '\n'; 53 | } 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /example/tut4.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut4.cpp ---------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 11 | #include 12 | #include 13 | #include 14 | #include 15 | using namespace std; 16 | using namespace boost::filesystem; 17 | 18 | int main(int argc, char* argv[]) 19 | { 20 | if (argc < 2) 21 | { 22 | cout << "Usage: tut4 path\n"; 23 | return 1; 24 | } 25 | 26 | path p (argv[1]); // p reads clearer than argv[1] in the following code 27 | 28 | try 29 | { 30 | if (exists(p)) // does p actually exist? 31 | { 32 | if (is_regular_file(p)) // is p a regular file? 33 | cout << p << " size is " << file_size(p) << '\n'; 34 | 35 | else if (is_directory(p)) // is p a directory? 36 | { 37 | cout << p << " is a directory containing:\n"; 38 | 39 | typedef vector vec; // store paths, 40 | vec v; // so we can sort them later 41 | 42 | copy(directory_iterator(p), directory_iterator(), back_inserter(v)); 43 | 44 | sort(v.begin(), v.end()); // sort, since directory iteration 45 | // is not ordered on some file systems 46 | 47 | for (vec::const_iterator it(v.begin()), it_end(v.end()); it != it_end; ++it) 48 | { 49 | cout << " " << *it << '\n'; 50 | } 51 | } 52 | else 53 | cout << p << " exists, but is neither a regular file nor a directory\n"; 54 | } 55 | else 56 | cout << p << " does not exist\n"; 57 | } 58 | 59 | catch (const filesystem_error& ex) 60 | { 61 | cout << ex.what() << '\n'; 62 | } 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /example/tut5.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut5.cpp ---------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 11 | #include 12 | #include 13 | namespace fs = boost::filesystem; 14 | 15 | int main() 16 | { 17 | // \u263A is "Unicode WHITE SMILING FACE = have a nice day!" 18 | std::string narrow_string ("smile2"); 19 | std::wstring wide_string (L"smile2\u263A"); 20 | std::list narrow_list; 21 | narrow_list.push_back('s'); 22 | narrow_list.push_back('m'); 23 | narrow_list.push_back('i'); 24 | narrow_list.push_back('l'); 25 | narrow_list.push_back('e'); 26 | narrow_list.push_back('3'); 27 | std::list wide_list; 28 | wide_list.push_back(L's'); 29 | wide_list.push_back(L'm'); 30 | wide_list.push_back(L'i'); 31 | wide_list.push_back(L'l'); 32 | wide_list.push_back(L'e'); 33 | wide_list.push_back(L'3'); 34 | wide_list.push_back(L'\u263A'); 35 | 36 | { fs::ofstream f("smile"); } 37 | { fs::ofstream f(L"smile\u263A"); } 38 | { fs::ofstream f(narrow_string); } 39 | { fs::ofstream f(wide_string); } 40 | { fs::ofstream f(narrow_list); } 41 | { fs::ofstream f(wide_list); } 42 | narrow_list.pop_back(); 43 | narrow_list.push_back('4'); 44 | wide_list.pop_back(); 45 | wide_list.pop_back(); 46 | wide_list.push_back(L'4'); 47 | wide_list.push_back(L'\u263A'); 48 | { fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end())); } 49 | { fs::ofstream f(fs::path(wide_list.begin(), wide_list.end())); } 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /example/tut6a.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut6a.cpp --------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 11 | #include 12 | #include 13 | using namespace boost::filesystem; 14 | 15 | int main(int argc, char* argv[]) 16 | { 17 | if (argc < 2) 18 | { 19 | std::cout << "Usage: tut6a path\n"; 20 | return 1; 21 | } 22 | 23 | try 24 | { 25 | for (recursive_directory_iterator it (argv[1]); 26 | it != recursive_directory_iterator(); 27 | ++it) 28 | { 29 | if (it.level() > 1) 30 | it.pop(); 31 | else 32 | { 33 | for (int i = 0; i <= it.level(); ++i) 34 | std::cout << " "; 35 | 36 | std::cout << it->path() << '\n'; 37 | } 38 | } 39 | } 40 | 41 | catch (const std::exception& ex) 42 | { 43 | std::cout << "************* exception *****************\n"; 44 | std::cout << ex.what() << '\n'; 45 | } 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /example/tut6b.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut6b.cpp --------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 11 | #include 12 | #include 13 | using namespace boost::filesystem; 14 | 15 | int main(int argc, char* argv[]) 16 | { 17 | if (argc < 2) 18 | { 19 | std::cout << "Usage: tut6b path\n"; 20 | return 1; 21 | } 22 | 23 | try 24 | { 25 | for (recursive_directory_iterator it (argv[1]); 26 | it != recursive_directory_iterator(); 27 | ) 28 | { 29 | for (int i = 0; i <= it.level(); ++i) 30 | std::cout << " "; 31 | 32 | std::cout << it->path() << '\n'; 33 | 34 | try { ++it; } 35 | catch (const filesystem_error& ex) 36 | { 37 | std::cout << "************* filesystem_error *****************\n"; 38 | std::cout << ex.what() << '\n'; 39 | } 40 | } 41 | } 42 | 43 | catch (const std::exception& ex) 44 | { 45 | std::cout << "************* exception *****************\n"; 46 | std::cout << ex.what() << '\n'; 47 | } 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /example/tut6c.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut6c.cpp --------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 11 | #include 12 | #include 13 | #include 14 | 15 | using namespace boost::filesystem; 16 | using namespace boost::system; 17 | 18 | int main(int argc, char* argv[]) 19 | { 20 | if (argc < 2) 21 | { 22 | std::cout << "Usage: tut6c path\n"; 23 | return 1; 24 | } 25 | 26 | error_code ec; 27 | for (recursive_directory_iterator it (argv[1], ec); 28 | it != recursive_directory_iterator(); 29 | ) 30 | { 31 | for (int i = 0; i <= it.level(); ++i) 32 | std::cout << " "; 33 | 34 | std::cout << it->path() << '\n'; 35 | 36 | it.increment(ec); 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /example/tut6d.cpp: -------------------------------------------------------------------------------- 1 | // filesystem tut6d.cpp --------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010, 2012 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 11 | #include 12 | #include 13 | using namespace boost::filesystem; 14 | 15 | int main(int argc, char* argv[]) 16 | { 17 | if (argc < 2) 18 | { 19 | std::cout << "Usage: tut6a path\n"; 20 | return 1; 21 | } 22 | 23 | try 24 | { 25 | for (recursive_directory_iterator it (argv[1], 26 | directory_options::treat_permission_denied_as_empty_directory); // note option 27 | it != recursive_directory_iterator(); 28 | ++it) 29 | { 30 | if (it.level() > 1) 31 | it.pop(); 32 | else 33 | { 34 | for (int i = 0; i <= it.level(); ++i) 35 | std::cout << " "; 36 | 37 | std::cout << it->path() << '\n'; 38 | } 39 | } 40 | } 41 | 42 | catch (const std::exception& ex) 43 | { 44 | std::cout << "************* exception *****************\n"; 45 | std::cout << ex.what() << '\n'; 46 | std::exit(1); 47 | } 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /include/boost/filesystem.hpp: -------------------------------------------------------------------------------- 1 | // boost/filesystem.hpp --------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 | //--------------------------------------------------------------------------------------// 11 | 12 | #ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP 13 | #define BOOST_FILESYSTEM_FILESYSTEM_HPP 14 | 15 | # include 16 | # include 17 | # include 18 | # include 19 | 20 | #endif // BOOST_FILESYSTEM_FILESYSTEM_HPP 21 | -------------------------------------------------------------------------------- /include/boost/filesystem/config.hpp: -------------------------------------------------------------------------------- 1 | // boost/filesystem/v3/config.hpp ----------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2003 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 | //--------------------------------------------------------------------------------------// 11 | 12 | #ifndef BOOST_FILESYSTEM3_CONFIG_HPP 13 | #define BOOST_FILESYSTEM3_CONFIG_HPP 14 | 15 | # if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 16 | # error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 17 | # endif 18 | 19 | # if !defined(BOOST_FILESYSTEM_VERSION) 20 | # define BOOST_FILESYSTEM_VERSION 3 21 | # endif 22 | 23 | #define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions 24 | 25 | // This header implements separate compilation features as described in 26 | // http://www.boost.org/more/separate_compilation.html 27 | 28 | #include 29 | #include // for BOOST_POSIX_API or BOOST_WINDOWS_API 30 | #include 31 | 32 | // BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------// 33 | 34 | # ifdef BOOST_FILESYSTEM_SOURCE 35 | # define BOOST_FILESYSTEM_DEPRECATED 36 | # endif 37 | 38 | // throw an exception ----------------------------------------------------------------// 39 | // 40 | // Exceptions were originally thrown via boost::throw_exception(). 41 | // As throw_exception() became more complex, it caused user error reporting 42 | // to be harder to interpret, since the exception reported became much more complex. 43 | // The immediate fix was to throw directly, wrapped in a macro to make any later change 44 | // easier. 45 | 46 | #define BOOST_FILESYSTEM_THROW(EX) throw EX 47 | 48 | # if defined( BOOST_NO_STD_WSTRING ) 49 | # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support 50 | # endif 51 | 52 | // This header implements separate compilation features as described in 53 | // http://www.boost.org/more/separate_compilation.html 54 | 55 | // normalize macros ------------------------------------------------------------------// 56 | 57 | #if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) \ 58 | && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK) 59 | # define BOOST_FILESYSTEM_STATIC_LINK 60 | #endif 61 | 62 | #if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK) 63 | # define BOOST_FILESYSTEM_DYN_LINK 64 | #elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) 65 | # define BOOST_FILESYSTEM_STATIC_LINK 66 | #endif 67 | 68 | #if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK) 69 | # error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK 70 | #endif 71 | 72 | #if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB) 73 | # define BOOST_FILESYSTEM_NO_LIB 74 | #endif 75 | 76 | // enable dynamic linking ------------------------------------------------------------// 77 | 78 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) 79 | # if defined(BOOST_FILESYSTEM_SOURCE) 80 | # define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT 81 | # else 82 | # define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT 83 | # endif 84 | #else 85 | # define BOOST_FILESYSTEM_DECL 86 | #endif 87 | 88 | // enable automatic library variant selection ----------------------------------------// 89 | 90 | #if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ 91 | && !defined(BOOST_FILESYSTEM_NO_LIB) 92 | // 93 | // Set the name of our library, this will get undef'ed by auto_link.hpp 94 | // once it's done with it: 95 | // 96 | #define BOOST_LIB_NAME boost_filesystem 97 | // 98 | // If we're importing code from a dll, then tell auto_link.hpp about it: 99 | // 100 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) 101 | # define BOOST_DYN_LINK 102 | #endif 103 | // 104 | // And include the header that does the work: 105 | // 106 | #include 107 | #endif // auto-linking disabled 108 | 109 | #endif // BOOST_FILESYSTEM3_CONFIG_HPP 110 | -------------------------------------------------------------------------------- /include/boost/filesystem/convenience.hpp: -------------------------------------------------------------------------------- 1 | // boost/filesystem/convenience.hpp ----------------------------------------// 2 | 3 | // Copyright Beman Dawes, 2002-2005 4 | // Copyright Vladimir Prus, 2002 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // See library home page at http://www.boost.org/libs/filesystem 10 | 11 | //----------------------------------------------------------------------------// 12 | 13 | #ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP 14 | #define BOOST_FILESYSTEM3_CONVENIENCE_HPP 15 | 16 | #include 17 | 18 | # if defined( BOOST_NO_STD_WSTRING ) 19 | # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support 20 | # endif 21 | 22 | #include 23 | #include 24 | 25 | #include // must be the last #include 26 | 27 | namespace boost 28 | { 29 | namespace filesystem 30 | { 31 | 32 | # ifndef BOOST_FILESYSTEM_NO_DEPRECATED 33 | 34 | inline std::string extension(const path & p) 35 | { 36 | return p.extension().string(); 37 | } 38 | 39 | inline std::string basename(const path & p) 40 | { 41 | return p.stem().string(); 42 | } 43 | 44 | inline path change_extension( const path & p, const path & new_extension ) 45 | { 46 | path new_p( p ); 47 | new_p.replace_extension( new_extension ); 48 | return new_p; 49 | } 50 | 51 | # endif 52 | 53 | 54 | } // namespace filesystem 55 | } // namespace boost 56 | 57 | #include // pops abi_prefix.hpp pragmas 58 | #endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP 59 | -------------------------------------------------------------------------------- /include/boost/filesystem/detail/utf8_codecvt_facet.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) 2 | // Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). 3 | 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #ifndef BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP 8 | #define BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP 9 | 10 | #include 11 | 12 | #define BOOST_UTF8_BEGIN_NAMESPACE \ 13 | namespace boost { namespace filesystem { namespace detail { 14 | 15 | #define BOOST_UTF8_END_NAMESPACE }}} 16 | #define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL 17 | 18 | #include 19 | 20 | #undef BOOST_UTF8_BEGIN_NAMESPACE 21 | #undef BOOST_UTF8_END_NAMESPACE 22 | #undef BOOST_UTF8_DECL 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /include/boost/filesystem/exception.hpp: -------------------------------------------------------------------------------- 1 | // boost/filesystem/exception.hpp -----------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2003 4 | // Use, modification, and distribution is subject to the Boost Software 5 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // This header is no longer used. The contents have been moved to path.hpp. 9 | // It is provided so that user code #includes do not have to be changed. 10 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Automatic redirection failed, please go to 7 | doc/index.htm. 8 |
9 |

© Copyright Beman Dawes, 2003

10 |

Distributed under the Boost Software License, Version 1.0. 11 | See http://www.boost.org/LICENSE_1_0.txt

12 | 13 | 14 | -------------------------------------------------------------------------------- /src/codecvt_error_category.cpp: -------------------------------------------------------------------------------- 1 | // codecvt_error_category implementation file ----------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 at http://www.boost.org/libs/filesystem 9 | 10 | //--------------------------------------------------------------------------------------// 11 | 12 | #include 13 | 14 | // define BOOST_FILESYSTEM_SOURCE so that knows 15 | // the library is being built (possibly exporting rather than importing code) 16 | #define BOOST_FILESYSTEM_SOURCE 17 | 18 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 19 | # define BOOST_SYSTEM_NO_DEPRECATED 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | //--------------------------------------------------------------------------------------// 31 | 32 | namespace 33 | { 34 | class codecvt_error_cat : public boost::system::error_category 35 | { 36 | public: 37 | codecvt_error_cat(){} 38 | const char* name() const; 39 | std::string message(int ev) const; 40 | }; 41 | 42 | const char* codecvt_error_cat::name() const 43 | { 44 | return "codecvt"; 45 | } 46 | 47 | std::string codecvt_error_cat::message(int ev) const 48 | { 49 | std::string str; 50 | switch (ev) 51 | { 52 | case std::codecvt_base::ok: 53 | str = "ok"; 54 | break; 55 | case std::codecvt_base::partial: 56 | str = "partial"; 57 | break; 58 | case std::codecvt_base::error: 59 | str = "error"; 60 | break; 61 | case std::codecvt_base::noconv: 62 | str = "noconv"; 63 | break; 64 | default: 65 | str = "unknown error"; 66 | } 67 | return str; 68 | } 69 | 70 | } // unnamed namespace 71 | 72 | namespace boost 73 | { 74 | namespace filesystem 75 | { 76 | 77 | BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category() 78 | { 79 | static const codecvt_error_cat codecvt_error_cat_const; 80 | return codecvt_error_cat_const; 81 | } 82 | 83 | } // namespace filesystem 84 | } // namespace boost 85 | -------------------------------------------------------------------------------- /src/portability.cpp: -------------------------------------------------------------------------------- 1 | // portability.cpp -------------------------------------------------------------------// 2 | 3 | // Copyright 2002-2005 Beman Dawes 4 | // Use, modification, and distribution is subject to the Boost Software 5 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy 6 | // at http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // See library home page at http://www.boost.org/libs/filesystem 9 | 10 | //--------------------------------------------------------------------------------------// 11 | 12 | // define BOOST_FILESYSTEM_SOURCE so that knows 13 | // the library is being built (possibly exporting rather than importing code) 14 | #define BOOST_FILESYSTEM_SOURCE 15 | 16 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 17 | # define BOOST_SYSTEM_NO_DEPRECATED 18 | #endif 19 | 20 | #include 21 | #include 22 | 23 | namespace fs = boost::filesystem; 24 | 25 | #include // SGI MIPSpro compilers need this 26 | 27 | # ifdef BOOST_NO_STDC_NAMESPACE 28 | namespace std { using ::strerror; } 29 | # endif 30 | 31 | //--------------------------------------------------------------------------------------// 32 | 33 | namespace 34 | { 35 | const char invalid_chars[] = 36 | "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" 37 | "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" 38 | "<>:\"/\\|"; 39 | // note that the terminating '\0' is part of the string - thus the size below 40 | // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I 41 | const std::string windows_invalid_chars(invalid_chars, sizeof(invalid_chars)); 42 | 43 | const std::string valid_posix( 44 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"); 45 | 46 | } // unnamed namespace 47 | 48 | namespace boost 49 | { 50 | namespace filesystem 51 | { 52 | 53 | // name_check functions ----------------------------------------------// 54 | 55 | # ifdef BOOST_WINDOWS 56 | BOOST_FILESYSTEM_DECL bool native(const std::string & name) 57 | { 58 | return windows_name(name); 59 | } 60 | # else 61 | BOOST_FILESYSTEM_DECL bool native(const std::string & name) 62 | { 63 | return name.size() != 0 64 | && name[0] != ' ' 65 | && name.find('/') == std::string::npos; 66 | } 67 | # endif 68 | 69 | BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name) 70 | { 71 | return name.size() != 0 72 | && name.find_first_not_of(valid_posix) == std::string::npos; 73 | } 74 | 75 | BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name) 76 | { 77 | return name.size() != 0 78 | && name[0] != ' ' 79 | && name.find_first_of(windows_invalid_chars) == std::string::npos 80 | && *(name.end()-1) != ' ' 81 | && (*(name.end()-1) != '.' 82 | || name.length() == 1 || name == ".."); 83 | } 84 | 85 | BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name) 86 | { 87 | return 88 | name.size() != 0 89 | && (name == "." 90 | || name == ".." 91 | || (windows_name(name) 92 | && portable_posix_name(name) 93 | && name[0] != '.' && name[0] != '-')); 94 | } 95 | 96 | BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name) 97 | { 98 | return 99 | name == "." 100 | || name == ".." 101 | || (portable_name(name) 102 | && name.find('.') == std::string::npos); 103 | } 104 | 105 | BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name) 106 | { 107 | std::string::size_type pos; 108 | return 109 | portable_name(name) 110 | && name != "." 111 | && name != ".." 112 | && ((pos = name.find('.')) == std::string::npos 113 | || (name.find('.', pos+1) == std::string::npos 114 | && (pos + 5) > name.length())) 115 | ; 116 | } 117 | 118 | } // namespace filesystem 119 | } // namespace boost 120 | -------------------------------------------------------------------------------- /src/unique_path.cpp: -------------------------------------------------------------------------------- 1 | // filesystem unique_path.cpp --------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 | //--------------------------------------------------------------------------------------// 11 | 12 | // define BOOST_FILESYSTEM_SOURCE so that knows 13 | // the library is being built (possibly exporting rather than importing code) 14 | #define BOOST_FILESYSTEM_SOURCE 15 | 16 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 17 | # define BOOST_SYSTEM_NO_DEPRECATED 18 | #endif 19 | 20 | #include 21 | 22 | # ifdef BOOST_POSIX_API 23 | # include 24 | # else // BOOST_WINDOWS_API 25 | # include 26 | # include 27 | # pragma comment(lib, "Advapi32.lib") 28 | # endif 29 | 30 | namespace { 31 | 32 | void fail(int err, boost::system::error_code* ec) 33 | { 34 | if (ec == 0) 35 | BOOST_FILESYSTEM_THROW( boost::system::system_error(err, 36 | boost::system::system_category(), 37 | "boost::filesystem::unique_path")); 38 | 39 | ec->assign(err, boost::system::system_category()); 40 | return; 41 | } 42 | 43 | void system_crypt_random(void* buf, std::size_t len, boost::system::error_code* ec) 44 | { 45 | # ifdef BOOST_POSIX_API 46 | 47 | int file = open("/dev/urandom", O_RDONLY); 48 | if (file == -1) 49 | { 50 | file = open("/dev/random", O_RDONLY); 51 | if (file == -1) 52 | { 53 | fail(errno, ec); 54 | return; 55 | } 56 | } 57 | 58 | size_t bytes_read = 0; 59 | while (bytes_read < len) 60 | { 61 | ssize_t n = read(file, buf, len - bytes_read); 62 | if (n == -1) 63 | { 64 | close(file); 65 | fail(errno, ec); 66 | return; 67 | } 68 | bytes_read += n; 69 | buf = static_cast(buf) + n; 70 | } 71 | 72 | close(file); 73 | 74 | # else // BOOST_WINDOWS_API 75 | 76 | HCRYPTPROV handle; 77 | int errval = 0; 78 | 79 | if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, 0)) 80 | { 81 | errval = ::GetLastError(); 82 | if (errval == NTE_BAD_KEYSET) 83 | { 84 | if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) 85 | { 86 | errval = ::GetLastError(); 87 | } 88 | else errval = 0; 89 | } 90 | } 91 | 92 | if (!errval) 93 | { 94 | BOOL gen_ok = ::CryptGenRandom(handle, len, static_cast(buf)); 95 | if (!gen_ok) 96 | errval = ::GetLastError(); 97 | ::CryptReleaseContext(handle, 0); 98 | } 99 | 100 | if (!errval) 101 | return; 102 | 103 | fail(errval, ec); 104 | # endif 105 | } 106 | 107 | } // unnamed namespace 108 | 109 | namespace boost { namespace filesystem { namespace detail { 110 | 111 | BOOST_FILESYSTEM_DECL 112 | path unique_path(const path& model, system::error_code* ec) 113 | { 114 | std::wstring s (model.wstring()); // std::string ng for MBCS encoded POSIX 115 | const wchar_t hex[] = L"0123456789abcdef"; 116 | const int n_ran = 16; 117 | const int max_nibbles = 2 * n_ran; // 4-bits per nibble 118 | char ran[n_ran]; 119 | 120 | int nibbles_used = max_nibbles; 121 | for(std::wstring::size_type i=0; i < s.size(); ++i) 122 | { 123 | if (s[i] == L'%') // digit request 124 | { 125 | if (nibbles_used == max_nibbles) 126 | { 127 | system_crypt_random(ran, sizeof(ran), ec); 128 | if (ec != 0 && *ec) 129 | return path(); 130 | nibbles_used = 0; 131 | } 132 | int c = ran[nibbles_used/2]; 133 | c >>= 4 * (nibbles_used++ & 1); // if odd, shift right 1 nibble 134 | s[i] = hex[c & 0xf]; // convert to hex digit and replace 135 | } 136 | } 137 | 138 | if (ec != 0) 139 | ec->clear(); 140 | 141 | return s; 142 | } 143 | 144 | }}} 145 | -------------------------------------------------------------------------------- /src/utf8_codecvt_facet.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Vladimir Prus 2004. 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE_1_0.txt 4 | // or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | // For HP-UX, request that WCHAR_MAX and WCHAR_MIN be defined as macros, 7 | // not casts. See ticket 5048 8 | #define _INCLUDE_STDCSOURCE_199901 9 | 10 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 11 | # define BOOST_SYSTEM_NO_DEPRECATED 12 | #endif 13 | 14 | #define BOOST_FILESYSTEM_SOURCE 15 | #include 16 | 17 | #define BOOST_UTF8_BEGIN_NAMESPACE \ 18 | namespace boost { namespace filesystem { namespace detail { 19 | 20 | #define BOOST_UTF8_END_NAMESPACE }}} 21 | #define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL 22 | 23 | #include 24 | 25 | #undef BOOST_UTF8_BEGIN_NAMESPACE 26 | #undef BOOST_UTF8_END_NAMESPACE 27 | #undef BOOST_UTF8_DECL 28 | -------------------------------------------------------------------------------- /src/windows_file_codecvt.cpp: -------------------------------------------------------------------------------- 1 | // filesystem windows_file_codecvt.cpp -----------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 | //--------------------------------------------------------------------------------------// 11 | 12 | // define BOOST_FILESYSTEM_SOURCE so that knows 13 | // the library is being built (possibly exporting rather than importing code) 14 | #define BOOST_FILESYSTEM_SOURCE 15 | 16 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 17 | # define BOOST_SYSTEM_NO_DEPRECATED 18 | #endif 19 | 20 | #include 21 | #include // for mbstate_t 22 | 23 | #ifdef BOOST_WINDOWS_API 24 | 25 | #include "windows_file_codecvt.hpp" 26 | 27 | // Versions of MinGW prior to GCC 4.6 requires this 28 | #ifndef WINVER 29 | # define WINVER 0x0500 30 | #endif 31 | 32 | #include 33 | 34 | std::codecvt_base::result windows_file_codecvt::do_in( 35 | std::mbstate_t &, 36 | const char* from, const char* from_end, const char*& from_next, 37 | wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const 38 | { 39 | UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; 40 | 41 | int count; 42 | if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from, 43 | from_end - from, to, to_end - to)) == 0) 44 | { 45 | return error; // conversion failed 46 | } 47 | 48 | from_next = from_end; 49 | to_next = to + count; 50 | *to_next = L'\0'; 51 | return ok; 52 | } 53 | 54 | std::codecvt_base::result windows_file_codecvt::do_out( 55 | std::mbstate_t &, 56 | const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next, 57 | char* to, char* to_end, char* & to_next) const 58 | { 59 | UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; 60 | 61 | int count; 62 | if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from, 63 | from_end - from, to, to_end - to, 0, 0)) == 0) 64 | { 65 | return error; // conversion failed 66 | } 67 | 68 | from_next = from_end; 69 | to_next = to + count; 70 | *to_next = '\0'; 71 | return ok; 72 | } 73 | 74 | # endif // BOOST_WINDOWS_API 75 | 76 | -------------------------------------------------------------------------------- /src/windows_file_codecvt.hpp: -------------------------------------------------------------------------------- 1 | // filesystem windows_file_codecvt.hpp -----------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009 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 | #ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP 11 | #define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP 12 | 13 | #include 14 | #include 15 | 16 | //------------------------------------------------------------------------------------// 17 | // // 18 | // class windows_file_codecvt // 19 | // // 20 | // Warning: partial implementation; even do_in and do_out only partially meet the // 21 | // standard library specifications as the "to" buffer must hold the entire result. // 22 | // // 23 | //------------------------------------------------------------------------------------// 24 | 25 | class BOOST_FILESYSTEM_DECL windows_file_codecvt 26 | : public std::codecvt< wchar_t, char, std::mbstate_t > 27 | { 28 | public: 29 | explicit windows_file_codecvt() 30 | : std::codecvt() {} 31 | protected: 32 | 33 | virtual bool do_always_noconv() const throw() { return false; } 34 | 35 | // seems safest to assume variable number of characters since we don't 36 | // actually know what codepage is active 37 | virtual int do_encoding() const throw() { return 0; } 38 | 39 | virtual std::codecvt_base::result do_in(std::mbstate_t& state, 40 | const char* from, const char* from_end, const char*& from_next, 41 | wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const; 42 | 43 | virtual std::codecvt_base::result do_out(std::mbstate_t & state, 44 | const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, 45 | char* to, char* to_end, char*& to_next) const; 46 | 47 | virtual std::codecvt_base::result do_unshift(std::mbstate_t&, 48 | char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; } 49 | 50 | virtual int do_length(std::mbstate_t&, 51 | const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; } 52 | 53 | virtual int do_max_length() const throw () { return 0; } 54 | }; 55 | 56 | #endif // BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP 57 | -------------------------------------------------------------------------------- /test/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost Filesystem Library test Jamfile 2 | 3 | # (C) Copyright Beman Dawes 2002-2006 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # See www.boost.org/LICENSE_1_0.txt 6 | 7 | project 8 | : requirements 9 | /boost/filesystem//boost_filesystem 10 | /boost/system//boost_system 11 | /boost/chrono//boost_chrono 12 | /boost/test//boost_prg_exec_monitor 13 | /boost/interop//boost_interop 14 | msvc:on 15 | ; 16 | 17 | # Some tests are run both statically and as shared libraries since Filesystem 18 | # has a history of bugs that appear only in one type of build or the other. 19 | 20 | test-suite "filesystem" : 21 | [ run convenience_test.cpp ] 22 | [ compile macro_default_test.cpp ] 23 | [ run deprecated_test.cpp ] 24 | [ run fstream_test.cpp ] 25 | [ run large_file_support_test.cpp ] 26 | [ run locale_info.cpp : : : always_show_run_output ] 27 | [ run operations_test.cpp : : : shared always_show_run_output ] 28 | [ run operations_test.cpp : : : static : operations_test_static ] 29 | [ run operations_unit_test.cpp : : : shared always_show_run_output ] 30 | [ run path_test.cpp : : : shared ] 31 | [ run path_test.cpp : : : static : path_test_static ] 32 | [ run path_unit_test.cpp : : : shared ] 33 | [ run path_unit_test.cpp : : : static : path_unit_test_static ] 34 | [ run ../example/simple_ls.cpp ] 35 | [ run ../example/file_status.cpp ] 36 | 37 | ; 38 | -------------------------------------------------------------------------------- /test/design_use_cases.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Minimal class path 5 | 6 | class path 7 | { 8 | public: 9 | path( const char * ) 10 | { 11 | std::cout << "path( const char * )\n"; 12 | } 13 | path( const std::string & ) 14 | { 15 | std::cout << "path( std::string & )\n"; 16 | } 17 | 18 | // for maximum efficiency, either signature must work 19 | # ifdef BY_VALUE 20 | operator const std::string() const 21 | # else 22 | operator const std::string&() const 23 | # endif 24 | { 25 | std::cout << "operator string\n"; 26 | return m_path; 27 | } 28 | 29 | #ifdef NAMED_CONVERSION 30 | std::string string() const 31 | { 32 | std::cout << "std::string string() const\n"; 33 | return m_path; 34 | } 35 | #endif 36 | 37 | private: 38 | std::string m_path; 39 | }; 40 | 41 | bool operator==( const path &, const path & ) 42 | { 43 | std::cout << "operator==( const path &, const path & )\n"; 44 | return true; 45 | } 46 | 47 | // These are the critical use cases. If any of these don't compile, usability 48 | // is unacceptably degraded. 49 | 50 | void f( const path & ) 51 | { 52 | std::cout << "f( const path & )\n"; 53 | } 54 | 55 | int main() 56 | { 57 | f( "foo" ); 58 | f( std::string( "foo" ) ); 59 | f( path( "foo" ) ); 60 | 61 | std::cout << '\n'; 62 | 63 | std::string s1( path( "foo" ) ); 64 | std::string s2 = path( "foo" ); 65 | s2 = path( "foo" ); 66 | 67 | #ifdef NAMED_CONVERSION 68 | s2 = path( "foo" ).string(); 69 | #endif 70 | 71 | std::cout << '\n'; 72 | 73 | // these must call bool path( const path &, const path & ); 74 | path( "foo" ) == path( "foo" ); 75 | path( "foo" ) == "foo"; 76 | path( "foo" ) == std::string( "foo" ); 77 | "foo" == path( "foo" ); 78 | std::string( "foo" ) == path( "foo" ); 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /test/equivalent.cpp: -------------------------------------------------------------------------------- 1 | // equivalent program -------------------------------------------------------// 2 | 3 | // Copyright (c) 2004 Beman Dawes 4 | 5 | // Use, modification, and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy 7 | // at http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | // See library home page at http://www.boost.org/libs/filesystem 10 | 11 | //----------------------------------------------------------------------------// 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | int main( int argc, char * argv[] ) 18 | { 19 | boost::filesystem::path::default_name_check( boost::filesystem::native ); 20 | if ( argc != 3 ) 21 | { 22 | std::cout << "Usage: equivalent path1 path2\n"; 23 | return 2; 24 | } 25 | 26 | bool eq; 27 | try 28 | { 29 | eq = boost::filesystem::equivalent( argv[1], argv[2] ); 30 | } 31 | catch ( const std::exception & ex ) 32 | { 33 | std::cout << ex.what() << "\n"; 34 | return 3; 35 | } 36 | 37 | std::cout << (eq ? "Paths are equivalent\n" : "Paths are not equivalent\n"); 38 | return !eq; 39 | } 40 | -------------------------------------------------------------------------------- /test/fstream_test.cpp: -------------------------------------------------------------------------------- 1 | // fstream_test.cpp ------------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2002 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 11 | 12 | // See deprecated_test for tests of deprecated features 13 | #ifndef BOOST_FILESYSTEM_NO_DEPRECATED 14 | # define BOOST_FILESYSTEM_NO_DEPRECATED 15 | #endif 16 | #ifndef BOOST_SYSTEM_NO_DEPRECATED 17 | # define BOOST_SYSTEM_NO_DEPRECATED 18 | #endif 19 | 20 | #include 21 | 22 | #include 23 | # if defined( BOOST_NO_STD_WSTRING ) 24 | # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support 25 | # endif 26 | 27 | #include 28 | #include 29 | #include 30 | #include // for std::remove 31 | 32 | #include 33 | 34 | namespace fs = boost::filesystem; 35 | 36 | #include 37 | #ifdef BOOST_NO_STDC_NAMESPACE 38 | namespace std { using ::remove; } 39 | #endif 40 | 41 | #include 42 | #include 43 | 44 | namespace 45 | { 46 | bool cleanup = true; 47 | 48 | void test(const fs::path & p) 49 | { 50 | fs::remove(p); 51 | { 52 | std::cout << " in test 1\n"; 53 | fs::filebuf fb1; 54 | fb1.open(p, std::ios_base::out); 55 | BOOST_TEST(fb1.is_open()); 56 | } 57 | { 58 | std::cout << " in test 2\n"; 59 | fs::filebuf fb2; 60 | fb2.open(p, std::ios_base::in); 61 | BOOST_TEST(fb2.is_open()); 62 | } 63 | { 64 | std::cout << " in test 3\n"; 65 | fs::ifstream tfs(p); 66 | BOOST_TEST(tfs.is_open()); 67 | } 68 | { 69 | std::cout << " in test 4\n"; 70 | fs::ifstream tfs(p / p.filename()); // should fail 71 | BOOST_TEST(!tfs.is_open()); 72 | } 73 | { 74 | std::cout << " in test 5\n"; 75 | fs::ifstream tfs(p, std::ios_base::in); 76 | BOOST_TEST(tfs.is_open()); 77 | } 78 | { 79 | std::cout << " in test 6\n"; 80 | fs::ifstream tfs; 81 | tfs.open(p); 82 | BOOST_TEST(tfs.is_open()); 83 | } 84 | { 85 | std::cout << " in test 7\n"; 86 | fs::ifstream tfs; 87 | tfs.open(p, std::ios_base::in); 88 | BOOST_TEST(tfs.is_open()); 89 | } 90 | { 91 | std::cout << " in test 8\n"; 92 | fs::ofstream tfs(p); 93 | BOOST_TEST(tfs.is_open()); 94 | } 95 | { 96 | std::cout << " in test 9\n"; 97 | fs::ofstream tfs(p, std::ios_base::out); 98 | BOOST_TEST(tfs.is_open()); 99 | } 100 | { 101 | std::cout << " in test 10\n"; 102 | fs::ofstream tfs; 103 | tfs.open(p); 104 | BOOST_TEST(tfs.is_open()); 105 | } 106 | { 107 | std::cout << " in test 11\n"; 108 | fs::ofstream tfs; 109 | tfs.open(p, std::ios_base::out); 110 | BOOST_TEST(tfs.is_open()); 111 | } 112 | { 113 | std::cout << " in test 12\n"; 114 | fs::fstream tfs(p); 115 | BOOST_TEST(tfs.is_open()); 116 | } 117 | { 118 | std::cout << " in test 13\n"; 119 | fs::fstream tfs(p, std::ios_base::in|std::ios_base::out); 120 | BOOST_TEST(tfs.is_open()); 121 | } 122 | { 123 | std::cout << " in test 14\n"; 124 | fs::fstream tfs; 125 | tfs.open(p); 126 | BOOST_TEST(tfs.is_open()); 127 | } 128 | { 129 | std::cout << " in test 15\n"; 130 | fs::fstream tfs; 131 | tfs.open(p, std::ios_base::in|std::ios_base::out); 132 | BOOST_TEST(tfs.is_open()); 133 | } 134 | 135 | if (cleanup) 136 | fs::remove(p); 137 | 138 | } // test 139 | } // unnamed namespace 140 | 141 | int cpp_main(int argc, char*[]) 142 | { 143 | if (argc > 1) cleanup = false; 144 | 145 | std::cout << "BOOST_FILESYSTEM_C_STR defined as \"" 146 | << BOOST_STRINGIZE(BOOST_FILESYSTEM_C_STR) << "\"\n"; 147 | 148 | // test narrow characters 149 | std::cout << "narrow character tests:\n"; 150 | test("narrow_fstream_test"); 151 | 152 | 153 | // So that tests are run with known encoding, use Boost UTF-8 codecvt 154 | std::locale global_loc = std::locale(); 155 | std::locale loc(global_loc, new fs::detail::utf8_codecvt_facet); 156 | fs::path::imbue(loc); 157 | 158 | // test with some wide characters 159 | // \u2780 is circled 1 against white background == e2 9e 80 in UTF-8 160 | // \u2781 is circled 2 against white background == e2 9e 81 in UTF-8 161 | // \u263A is a white smiling face 162 | std::cout << "\nwide character tests:\n"; 163 | std::wstring ws(L"wide_fstream_test_"); 164 | ws += 0x2780; 165 | ws += 0x263A; 166 | test(ws); 167 | 168 | return ::boost::report_errors(); 169 | } 170 | -------------------------------------------------------------------------------- /test/large_file_support_test.cpp: -------------------------------------------------------------------------------- 1 | // Boost large_file_support_test.cpp ---------------------------------------// 2 | 3 | // Copyright Beman Dawes 2004. 4 | // Use, modification, and distribution is subject to the Boost Software 5 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // See library home page at http://www.boost.org/libs/filesystem 9 | 10 | // See deprecated_test for tests of deprecated features 11 | #define BOOST_FILESYSTEM_NO_DEPRECATED 12 | #define BOOST_SYSTEM_NO_DEPRECATED 13 | 14 | #include 15 | 16 | #include 17 | # if defined( BOOST_NO_STD_WSTRING ) 18 | # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support 19 | # endif 20 | 21 | namespace fs = boost::filesystem; 22 | 23 | #include 24 | 25 | int main() 26 | { 27 | if ( fs::detail::possible_large_file_size_support() ) 28 | { 29 | std::cout << "It appears that file sizes greater that 2 gigabytes are possible\n" 30 | "for this configuration on this platform since the operating system\n" 31 | "does use a large enough integer type to report large file sizes.\n\n" 32 | "Whether or not such support is actually present depends on the OS\n"; 33 | return 0; 34 | } 35 | std::cout << "The operating system is using an integer type to report file sizes\n" 36 | "that can not represent file sizes greater that 2 gigabytes (31-bits).\n" 37 | "Thus the Filesystem Library will not correctly deal with such large\n" 38 | "files. If you think that this operatiing system should be able to\n" 39 | "support large files, please report the problem to the Boost developers\n" 40 | "mailing list.\n"; 41 | return 1; 42 | } 43 | -------------------------------------------------------------------------------- /test/locale_info.cpp: -------------------------------------------------------------------------------- 1 | // locale_info.cpp ---------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2011 4 | 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // See http://www.boost.org/LICENSE_1_0.txt 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #ifndef BOOST_NO_CXX11_HDR_CODECVT 15 | # include 16 | #endif 17 | 18 | using namespace std; 19 | 20 | #ifdef _MSC_VER 21 | # pragma warning(push) 22 | # pragma warning(disable: 4996) // ... Function call with parameters that may be unsafe 23 | #endif 24 | 25 | namespace 26 | { 27 | void facet_info(const locale& loc, const char* msg) 28 | { 29 | cout << "has_facet >(" 30 | << msg << ") is " 31 | << (has_facet >(loc) 32 | ? "true\n" 33 | : "false\n"); 34 | cout << "has_facet >(" 35 | << msg << ") is " 36 | << (has_facet >(loc) 37 | ? "true\n" 38 | : "false\n"); 39 | #ifndef BOOST_NO_CXX11_HDR_CODECVT 40 | cout << "has_facet >(" 41 | << msg << ") is " 42 | << (has_facet >(loc) 43 | ? "true\n" 44 | : "false\n"); 45 | #endif 46 | #ifndef BOOST_NO_CXX11_HDR_CODECVT 47 | cout << "has_facet >(" 48 | << msg << ") is " 49 | << (has_facet >(loc) 50 | ? "true\n" 51 | : "false\n"); 52 | #endif 53 | } 54 | 55 | void default_info() 56 | { 57 | try 58 | { 59 | locale loc; 60 | cout << "\nlocale default construction OK, name is " << loc.name() << endl; 61 | facet_info(loc, "locale()"); 62 | } 63 | catch (const exception& ex) 64 | { 65 | cout << "\nlocale default construction threw: " << ex.what() << endl; 66 | } 67 | } 68 | 69 | void null_string_info() 70 | { 71 | try 72 | { 73 | locale loc(""); 74 | cout << "\nlocale(\"\") construction OK, name is " << loc.name() << endl; 75 | facet_info(loc, "locale(\"\")"); 76 | } 77 | catch (const exception& ex) 78 | { 79 | cout << "\nlocale(\"\") construction threw: " << ex.what() << endl; 80 | } 81 | } 82 | 83 | void classic_info() 84 | { 85 | try 86 | { 87 | locale loc(locale::classic()); 88 | cout << "\nlocale(locale::classic()) copy construction OK, name is " << loc.name() << endl; 89 | facet_info(loc, "locale::classic()"); 90 | } 91 | catch (const exception& ex) 92 | { 93 | cout << "\nlocale(locale::clasic()) copy construction threw: " << ex.what() << endl; 94 | } 95 | } 96 | 97 | void codecvt_info(const locale& loc) 98 | { 99 | cout << "\ncodecvt conversion for locale " << loc.name() << endl; 100 | 101 | char s[128]; 102 | wchar_t ws[128]; 103 | 104 | for (int i = 0; i < 128; ++i) 105 | { 106 | s[i] = char(128 + i); 107 | ws[i] = L'\0'; 108 | } 109 | 110 | mbstate_t state = mbstate_t(); // VC++ needs initialization 111 | const char* from_next; 112 | wchar_t* to_next; 113 | codecvt::result result; 114 | 115 | try 116 | { 117 | result = use_facet >(loc).in(state, s, s+128, from_next, ws, ws+128, to_next); 118 | } 119 | catch (const runtime_error& x) 120 | { 121 | cout << "exception: " << x.what() << endl; 122 | return; 123 | } 124 | 125 | if (result != codecvt::ok) 126 | { 127 | cout << "Oops! conversion returned " << result << endl; 128 | return; 129 | } 130 | 131 | cout << hex; 132 | for (int i = 0; i < 128; ++i) 133 | { 134 | cout << s[i] << ':' << (unsigned short)(ws[i]); 135 | if (i % 8) 136 | cout << ','; 137 | else 138 | cout << endl; 139 | } 140 | cout << endl; 141 | } 142 | } 143 | 144 | int main() 145 | { 146 | const char* lang = getenv("LANG"); 147 | cout << "\nLANG environmental variable is " 148 | << (lang ? lang : "not present") << endl; 149 | 150 | #ifndef BOOST_NO_CXX11_HDR_CODECVT 151 | cout << "BOOST_NO_CXX11_HDR_CODECVT is not defined" << endl; 152 | #else 153 | cout << "BOOST_NO_CXX11_HDR_CODECVT is defined" << endl; 154 | #endif 155 | 156 | #ifndef BOOST_NO_CXX11_CHAR16_T 157 | cout << "BOOST_NO_CXX11_CHAR16_T is not defined" << endl; 158 | #else 159 | cout << "BOOST_NO_CXX11_CHAR16_T is defined" << endl; 160 | #endif 161 | 162 | #ifndef BOOST_NO_CXX11_CHAR32_T 163 | cout << "BOOST_NO_CXX11_CHAR32_T is not defined" << endl; 164 | #else 165 | cout << "BOOST_NO_CXX11_CHAR32_T is defined" << endl; 166 | #endif 167 | 168 | default_info(); 169 | null_string_info(); 170 | classic_info(); 171 | 172 | codecvt_info(locale()); 173 | codecvt_info(locale("")); 174 | 175 | return 0; 176 | } 177 | 178 | #ifdef _MSC_VER 179 | # pragma warning(pop) 180 | #endif 181 | -------------------------------------------------------------------------------- /test/long_path_test.cpp: -------------------------------------------------------------------------------- 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 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace boost::filesystem; 19 | 20 | #include 21 | 22 | #ifndef BOOST_LIGHTWEIGHT_MAIN 23 | # include 24 | #else 25 | # include 26 | #endif 27 | 28 | namespace 29 | { 30 | } // unnamed namespace 31 | 32 | int cpp_main(int, char*[]) 33 | { 34 | 35 | std::string prefix("d:\\temp\\"); 36 | std::cout << "prefix is " << prefix << '\n'; 37 | 38 | const std::size_t safe_size 39 | = 260 - prefix.size() - 100; // Windows MAX_PATH is 260 40 | 41 | std::string safe_x_string(safe_size, 'x'); 42 | std::string safe_y_string(safe_size, 'y'); 43 | std::string path_escape("\\\\?\\"); 44 | 45 | path x_p(prefix + safe_x_string); 46 | path y_p(path_escape + prefix + safe_x_string + "\\" + safe_y_string); 47 | 48 | std::cout << "x_p.native().size() is " << x_p.native().size() << '\n'; 49 | std::cout << "y_p.native().size() is " << y_p.native().size() << '\n'; 50 | 51 | create_directory(x_p); 52 | BOOST_TEST(exists(x_p)); 53 | create_directory(y_p); 54 | BOOST_TEST(exists(y_p)); 55 | 56 | //std::cout << "directory x.../y... ready for testing, where ... is " << safe_size 57 | // << " repeats of x and y, respectively\n"; 58 | 59 | BOOST_TEST(exists(x_p)); 60 | 61 | //remove_all(x_p); 62 | 63 | return ::boost::report_errors(); 64 | } 65 | -------------------------------------------------------------------------------- /test/macro_default_test.cpp: -------------------------------------------------------------------------------- 1 | // macro_default_test program --------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2012 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 | #undef BOOST_ALL_DYN_LINK 11 | #undef BOOST_ALL_STATIC_LINK 12 | #undef BOOST_FILESYSTEM_DYN_LINK 13 | #undef BOOST_FILESYSTEM_STATIC_LINK 14 | #undef BOOST_SYSTEM_DYN_LINK 15 | #undef BOOST_SYSTEM_STATIC_LINK 16 | 17 | #ifndef BOOST_ALL_NO_LIB 18 | # define BOOST_ALL_NO_LIB 19 | #endif 20 | 21 | #include 22 | #include 23 | 24 | #ifndef BOOST_FILESYSTEM_STATIC_LINK 25 | # error BOOST_FILESYSTEM_STATIC_LINK not set by default 26 | #endif 27 | 28 | 29 | #ifndef BOOST_SYSTEM_STATIC_LINK 30 | # error BOOST_SYSTEM_STATIC_LINK not set by default 31 | #endif 32 | 33 | int main() 34 | { 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /test/msvc10/common.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.30319.1 5 | $(TEMP)\$(SolutionName)\$(Configuration)\ 6 | $(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\ 7 | 8 | 9 | 10 | ../../../../..;%(AdditionalIncludeDirectories) 11 | BOOST_SYSTEM_NO_DEPRECATED;BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;BOOST_FILESYSTEM_USE_TIME_T;%(PreprocessorDefinitions) 12 | Async 13 | false 14 | Level4 15 | 16 | 17 | %(AdditionalLibraryDirectories) 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/msvc10/convenience_test/convenience_test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {08986FB5-0C83-4BC4-92DF-05E12E1C03C1} 15 | convenience_test 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 49 | true 50 | EnableFastChecks 51 | MultiThreadedDebugDLL 52 | 53 | 54 | Level4 55 | EditAndContinue 56 | 57 | 58 | true 59 | Console 60 | MachineX86 61 | 62 | 63 | Executing test $(TargetName).exe... 64 | "$(TargetDir)\$(TargetName).exe" 65 | 66 | 67 | 68 | 69 | MaxSpeed 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | MultiThreadedDLL 73 | true 74 | 75 | 76 | Level4 77 | ProgramDatabase 78 | 79 | 80 | true 81 | Console 82 | true 83 | true 84 | MachineX86 85 | 86 | 87 | Executing test $(TargetName).exe... 88 | "$(TargetDir)\$(TargetName).exe" 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | {0ea788ca-fa52-4290-a4d0-f616390b203b} 97 | 98 | 99 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 100 | false 101 | 102 | 103 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 104 | false 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /test/msvc10/exec_monitor_dll/exec_monitor_dll.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {0EA788CA-FA52-4290-A4D0-F616390B203B} 15 | Win32Proj 16 | exec_monitor_dll 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | Unicode 23 | 24 | 25 | DynamicLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_WINDOWS;_USRDLL;EXEC_MONITOR_DLL_EXPORTS;%(PreprocessorDefinitions) 55 | 56 | 57 | Windows 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_WINDOWS;_USRDLL;EXEC_MONITOR_DLL_EXPORTS;%(PreprocessorDefinitions) 70 | 71 | 72 | Windows 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /test/msvc10/exec_monitor_lib/exec_monitor_lib.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {272DFC15-6292-49DF-B457-6784A183EAC3} 20 | Win32Proj 21 | exec_monitor_lib 22 | 23 | 24 | 25 | StaticLibrary 26 | true 27 | Unicode 28 | 29 | 30 | StaticLibrary 31 | false 32 | true 33 | Unicode 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | NotUsing 49 | Level3 50 | Disabled 51 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 52 | ../../../../..;%(AdditionalIncludeDirectories) 53 | 54 | 55 | Windows 56 | true 57 | 58 | 59 | 60 | 61 | Level3 62 | NotUsing 63 | MaxSpeed 64 | true 65 | true 66 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 67 | ../../../../..;%(AdditionalIncludeDirectories) 68 | 69 | 70 | Windows 71 | true 72 | true 73 | true 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /test/msvc10/file_status/file_status.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426} 15 | Win32Proj 16 | file_status 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | "$(TargetDir)\$(TargetName).exe" 62 | Executing test $(TargetName).exe... 63 | 64 | 65 | 66 | 67 | Level3 68 | 69 | 70 | MaxSpeed 71 | true 72 | true 73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 74 | 75 | 76 | Console 77 | true 78 | true 79 | true 80 | 81 | 82 | "$(TargetDir)\$(TargetName).exe" 83 | Executing test $(TargetName).exe... 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | {0ea788ca-fa52-4290-a4d0-f616390b203b} 92 | 93 | 94 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 95 | 96 | 97 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /test/msvc10/filesystem_lib/filesystem_lib.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | {3640605d-6f82-493d-879f-8f30762da554} 26 | 27 | 28 | 29 | {2C1770A4-4AC3-4102-9D36-E652DBB686D8} 30 | Win32Proj 31 | filesystem_lib 32 | 33 | 34 | 35 | StaticLibrary 36 | true 37 | Unicode 38 | 39 | 40 | StaticLibrary 41 | false 42 | true 43 | Unicode 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Level3 61 | Disabled 62 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 63 | ../../../../.. 64 | 65 | 66 | Windows 67 | true 68 | 69 | 70 | 71 | 72 | Level3 73 | 74 | 75 | MaxSpeed 76 | true 77 | true 78 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 79 | ../../../../.. 80 | 81 | 82 | Windows 83 | true 84 | true 85 | true 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /test/msvc10/fstream_test/fstream_test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {A9939CD7-BE1C-4334-947C-4C320D49B3CA} 15 | fstream_test 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 49 | true 50 | EnableFastChecks 51 | MultiThreadedDebugDLL 52 | 53 | 54 | Level4 55 | EditAndContinue 56 | 57 | 58 | true 59 | Console 60 | MachineX86 61 | 62 | 63 | Executing test $(TargetName).exe... 64 | "$(TargetDir)\$(TargetName).exe" -no-cleanup 65 | 66 | 67 | 68 | 69 | MaxSpeed 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | MultiThreadedDLL 73 | true 74 | 75 | 76 | Level4 77 | ProgramDatabase 78 | 79 | 80 | true 81 | Console 82 | true 83 | true 84 | MachineX86 85 | 86 | 87 | Executing test $(TargetName).exe... 88 | "$(TargetDir)\$(TargetName).exe" -no-cleanup 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 97 | false 98 | 99 | 100 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 101 | false 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /test/msvc10/interop_dll/interop_dll.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {D9104E71-73E5-4603-882B-201B811C3540} 15 | Win32Proj 16 | interop_dll 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | Unicode 23 | 24 | 25 | DynamicLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_WINDOWS;_USRDLL;INTEROP_DLL_EXPORTS;%(PreprocessorDefinitions) 55 | 56 | 57 | Windows 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_WINDOWS;_USRDLL;INTEROP_DLL_EXPORTS;%(PreprocessorDefinitions) 70 | 71 | 72 | Windows 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /test/msvc10/locale_info/locale_info.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {3667C35E-78D5-43D4-AAC2-349145E4341D} 15 | Win32Proj 16 | locale_info 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | "$(TargetDir)\$(TargetName).exe" 62 | 63 | 64 | Executing test $(TargetName).exe... 65 | 66 | 67 | 68 | 69 | Level3 70 | 71 | 72 | MaxSpeed 73 | true 74 | true 75 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 76 | 77 | 78 | Console 79 | true 80 | true 81 | true 82 | 83 | 84 | "$(TargetDir)\$(TargetName).exe" 85 | 86 | 87 | Executing test $(TargetName).exe... 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /test/msvc10/long_path_test/long_path_test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {1A6A7DAF-8705-4B2B-83B5-93F84A63496C} 15 | Win32Proj 16 | long_path_test 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | "$(TargetDir)\$(TargetName).exe" 62 | Executing test $(TargetName).exe... 63 | 64 | 65 | 66 | 67 | Level3 68 | 69 | 70 | MaxSpeed 71 | true 72 | true 73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 74 | 75 | 76 | Console 77 | true 78 | true 79 | true 80 | 81 | 82 | "$(TargetDir)\$(TargetName).exe" 83 | Executing test $(TargetName).exe... 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | {0ea788ca-fa52-4290-a4d0-f616390b203b} 92 | 93 | 94 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 95 | 96 | 97 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /test/msvc10/macro_default_test/macro_default_test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {36E2032D-F9E6-4FBA-9630-3D4AC518DC6C} 15 | Win32Proj 16 | macro_default_test 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 53 | ../../../../.. 54 | 55 | 56 | Console 57 | true 58 | 59 | 60 | 61 | 62 | Level3 63 | 64 | 65 | MaxSpeed 66 | true 67 | true 68 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 69 | 70 | 71 | Console 72 | true 73 | true 74 | true 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | {2c1770a4-4ac3-4102-9d36-e652dbb686d8} 83 | 84 | 85 | {3640605d-6f82-493d-879f-8f30762da554} 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /test/msvc10/operations_test/operations_test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {8BB7E604-46EF-42BE-ABB5-D7044B3E8A40} 15 | operations_test 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | BOOST_FILEYSTEM_INCLUDE_IOSTREAM;%(PreprocessorDefinitions) 49 | true 50 | EnableFastChecks 51 | MultiThreadedDebugDLL 52 | 53 | 54 | Level4 55 | EditAndContinue 56 | 57 | 58 | true 59 | Console 60 | MachineX86 61 | 62 | 63 | Executing test $(TargetName).exe... 64 | "$(TargetDir)\$(TargetName).exe" 65 | 66 | 67 | 68 | 69 | MaxSpeed 70 | true 71 | MultiThreadedDLL 72 | true 73 | 74 | 75 | Level4 76 | ProgramDatabase 77 | 78 | 79 | true 80 | Console 81 | true 82 | true 83 | MachineX86 84 | 85 | 86 | Executing test $(TargetName).exe... 87 | "$(TargetDir)\$(TargetName).exe" 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | {0ea788ca-fa52-4290-a4d0-f616390b203b} 96 | 97 | 98 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 99 | false 100 | 101 | 102 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 103 | false 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /test/msvc10/path_test_static/path_test_static.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {3B3010C5-D6D7-4320-A992-4EA61F256279} 15 | Win32Proj 16 | path_test_static 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 53 | ../../../../.. 54 | 55 | 56 | Console 57 | true 58 | 59 | 60 | "$(TargetDir)\$(TargetName).exe" 61 | 62 | 63 | Executing test $(TargetName).exe... 64 | 65 | 66 | 67 | 68 | Level3 69 | 70 | 71 | MaxSpeed 72 | true 73 | true 74 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 75 | ../../../../.. 76 | 77 | 78 | Console 79 | true 80 | true 81 | true 82 | 83 | 84 | "$(TargetDir)\$(TargetName).exe" 85 | 86 | 87 | Executing test $(TargetName).exe... 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | {272dfc15-6292-49df-b457-6784a183eac3} 96 | 97 | 98 | {2c1770a4-4ac3-4102-9d36-e652dbb686d8} 99 | 100 | 101 | {3640605d-6f82-493d-879f-8f30762da554} 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /test/msvc10/stems/stems.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {23C735E1-0195-467F-BE9F-314829402FCF} 15 | Win32Proj 16 | stems 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | 71 | 72 | Console 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 84 | 85 | 86 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /test/msvc10/system_dll/system_dll.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | 15 | 16 | 17 | {F94CCADD-A90B-480C-A304-C19D015D36B1} 18 | system_dll 19 | Win32Proj 20 | 21 | 22 | 23 | DynamicLibrary 24 | Unicode 25 | true 26 | 27 | 28 | DynamicLibrary 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | <_ProjectFileVersion>10.0.30319.1 45 | $(TEMP)\$(SolutionName)\$(Configuration)\ 46 | $(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\ 47 | true 48 | $(TEMP)\$(SolutionName)\$(Configuration)\ 49 | $(TEMP)\$(SolutionName)\$(ProjectName)\$(Configuration)\ 50 | false 51 | 52 | 53 | 54 | Disabled 55 | BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;_DEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions) 56 | true 57 | Async 58 | EnableFastChecks 59 | MultiThreadedDebugDLL 60 | 61 | 62 | Level4 63 | EditAndContinue 64 | 65 | 66 | true 67 | Windows 68 | MachineX86 69 | 70 | 71 | 72 | 73 | MaxSpeed 74 | true 75 | BOOST_ALL_NO_LIB;BOOST_ALL_DYN_LINK;WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSTEM_DLL_EXPORTS;%(PreprocessorDefinitions) 76 | Async 77 | MultiThreadedDLL 78 | true 79 | 80 | 81 | Level4 82 | ProgramDatabase 83 | 84 | 85 | true 86 | Windows 87 | true 88 | true 89 | MachineX86 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /test/msvc10/system_lib/system_lib.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {3640605D-6F82-493D-879F-8F30762DA554} 15 | Win32Proj 16 | system_lib 17 | 18 | 19 | 20 | StaticLibrary 21 | true 22 | Unicode 23 | 24 | 25 | StaticLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Level3 46 | Disabled 47 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 48 | ../../../../.. 49 | 50 | 51 | Windows 52 | true 53 | 54 | 55 | 56 | 57 | Level3 58 | 59 | 60 | MaxSpeed 61 | true 62 | true 63 | BOOST_ALL_NO_LIB;BOOST_ALL_STATIC_LINK;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 64 | ../../../../.. 65 | 66 | 67 | Windows 68 | true 69 | true 70 | true 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /test/msvc10/tut1/tut1.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {6376B8E4-7FD4-466B-978E-E8DA6E938689} 15 | tut1 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | %(AdditionalIncludeDirectories) 49 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 50 | true 51 | EnableFastChecks 52 | MultiThreadedDebugDLL 53 | 54 | 55 | Level4 56 | EditAndContinue 57 | 58 | 59 | true 60 | Console 61 | MachineX86 62 | 63 | 64 | 65 | 66 | MaxSpeed 67 | true 68 | %(AdditionalIncludeDirectories) 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | MultiThreadedDLL 71 | true 72 | 73 | 74 | Level4 75 | ProgramDatabase 76 | 77 | 78 | true 79 | Console 80 | true 81 | true 82 | MachineX86 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 91 | false 92 | 93 | 94 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 95 | false 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /test/msvc10/tut2/tut2.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {CD69B175-389E-4F8F-85DC-03C56A47CD1D} 15 | tut2 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 49 | true 50 | EnableFastChecks 51 | MultiThreadedDebugDLL 52 | 53 | 54 | EditAndContinue 55 | 56 | 57 | true 58 | Console 59 | MachineX86 60 | 61 | 62 | 63 | 64 | MaxSpeed 65 | true 66 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 67 | MultiThreadedDLL 68 | true 69 | 70 | 71 | ProgramDatabase 72 | 73 | 74 | true 75 | Console 76 | true 77 | true 78 | MachineX86 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 87 | false 88 | 89 | 90 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 91 | false 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /test/msvc10/tut3/tut3.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {4FF64FA7-6806-401D-865C-79DD064D4A9E} 15 | tut3 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | true 49 | EnableFastChecks 50 | MultiThreadedDebugDLL 51 | 52 | 53 | EditAndContinue 54 | 55 | 56 | true 57 | Console 58 | MachineX86 59 | 60 | 61 | 62 | 63 | MaxSpeed 64 | true 65 | MultiThreadedDLL 66 | true 67 | 68 | 69 | ProgramDatabase 70 | 71 | 72 | true 73 | Console 74 | true 75 | true 76 | MachineX86 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 85 | false 86 | 87 | 88 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 89 | false 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /test/msvc10/tut4/tut4.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {256EA89A-E073-4CE8-B675-BE2FBC6B2691} 15 | tut4 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | 24 | 25 | Application 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>10.0.30319.1 42 | true 43 | false 44 | 45 | 46 | 47 | Disabled 48 | %(AdditionalIncludeDirectories) 49 | true 50 | EnableFastChecks 51 | MultiThreadedDebugDLL 52 | 53 | 54 | EditAndContinue 55 | 56 | 57 | true 58 | Console 59 | MachineX86 60 | 61 | 62 | 63 | 64 | MaxSpeed 65 | true 66 | %(AdditionalIncludeDirectories) 67 | MultiThreadedDLL 68 | true 69 | 70 | 71 | ProgramDatabase 72 | 73 | 74 | true 75 | Console 76 | true 77 | true 78 | MachineX86 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 87 | false 88 | 89 | 90 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 91 | false 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /test/msvc10/tut5/tut5.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {5C9B3380-3C6E-45CC-986A-16D245E27E58} 15 | Win32Proj 16 | tut5 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | 71 | 72 | Console 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 84 | 85 | 86 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /test/msvc10/tut6a/tut6a.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {C781F9C4-31D4-4509-B031-84DB598B207D} 15 | Win32Proj 16 | tut6a 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | 71 | 72 | Console 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 84 | 85 | 86 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /test/msvc10/tut6b/tut6b.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {4A77CA6A-8E72-4CC6-9FE7-2C555C51815C} 15 | Win32Proj 16 | tut6b 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | 71 | 72 | Console 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 84 | 85 | 86 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /test/msvc10/tut6c/tut6c.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {17C6DD1B-EF6F-4561-B4FF-CF39F975ED29} 15 | Win32Proj 16 | tut6c 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | 71 | 72 | Console 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 84 | 85 | 86 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /test/msvc10/windows_attributes/windows_attributes.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {FC5C770F-3017-4021-8DAF-C5DCA3FDF005} 15 | Win32Proj 16 | windows_attributes 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | true 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | Level3 53 | Disabled 54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 55 | 56 | 57 | Console 58 | true 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 70 | 71 | 72 | Console 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {0ea788ca-fa52-4290-a4d0-f616390b203b} 84 | 85 | 86 | {ffd738f7-96f0-445c-81ea-551665ef53d1} 87 | 88 | 89 | {f94ccadd-a90b-480c-a304-c19d015d36b1} 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /test/sample_test.cpp: -------------------------------------------------------------------------------- 1 | // filesystem sample_test.cpp ----------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2012 4 | 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // See http://www.boost.org/LICENSE_1_0.txt 7 | 8 | // --------------------------------------------------------------------------// 9 | // 10 | // This program provides a template for bug reporting test cases. 11 | // 12 | // --------------------------------------------------------------------------// 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #ifndef BOOST_LIGHTWEIGHT_MAIN 21 | # include 22 | #else 23 | # include 24 | #endif 25 | 26 | namespace fs = boost::filesystem; 27 | using fs::path; 28 | using std::cout; 29 | using std::endl; 30 | using std::string; 31 | using std::wstring; 32 | 33 | namespace 34 | { 35 | bool cleanup = true; 36 | } 37 | 38 | // cpp_main ----------------------------------------------------------------// 39 | 40 | int cpp_main(int argc, char* argv[]) 41 | { 42 | if (argc > 1 && std::strcmp(argv[1], "--no-cleanup") == 0) 43 | cleanup = false; 44 | 45 | // Test cases go after this block of comments 46 | // Use test case macros from boost/detail/lightweight_test.hpp: 47 | // 48 | // BOOST_TEST(predicate); // test passes if predicate evaluates to true 49 | // BOOST_TEST_EQ(x, y); // test passes if x == y 50 | // BOOST_TEST_NE(x, y); // test passes if x != y 51 | // BOOST_ERROR(msg); // test fails, outputs msg 52 | // Examples: 53 | // BOOST_TEST(path("f00").size() == 3); // test passes 54 | // BOOST_TEST_EQ(path("f00").size(), 3); // test passes 55 | // BOOST_MSG("Oops!"); // test fails, outputs "Oops!" 56 | 57 | if (cleanup) 58 | { 59 | // Remove any test files or directories here 60 | } 61 | 62 | return ::boost::report_errors(); 63 | } 64 | -------------------------------------------------------------------------------- /test/test_codecvt.hpp: -------------------------------------------------------------------------------- 1 | // test_codecvt.hpp ------------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2009, 2010 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 | #ifndef BOOST_FILESYSTEM3_TEST_CODECVT_HPP 11 | #define BOOST_FILESYSTEM3_TEST_CODECVT_HPP 12 | 13 | #include 14 | #include 15 | #include // for mbstate_t 16 | 17 | //------------------------------------------------------------------------------------// 18 | // // 19 | // class test_codecvt // 20 | // // 21 | // Warning: partial implementation; even do_in and do_out only partially meet the // 22 | // standard library specifications as the "to" buffer must hold the entire result. // 23 | // // 24 | // The value of a wide character is the value of the corresponding narrow character // 25 | // plus 1. This ensures that compares against expected values will fail if the // 26 | // code conversion did not occur as expected. // 27 | // // 28 | //------------------------------------------------------------------------------------// 29 | 30 | class test_codecvt 31 | : public std::codecvt< wchar_t, char, std::mbstate_t > 32 | { 33 | public: 34 | explicit test_codecvt() 35 | : std::codecvt() {} 36 | protected: 37 | 38 | virtual bool do_always_noconv() const throw() { return false; } 39 | 40 | virtual int do_encoding() const throw() { return 0; } 41 | 42 | virtual std::codecvt_base::result do_in(std::mbstate_t&, 43 | const char* from, const char* from_end, const char*& from_next, 44 | wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const 45 | { 46 | for (; from != from_end && to != to_end; ++from, ++to) 47 | *to = *from + 1; 48 | if (to == to_end) 49 | return error; 50 | *to = L'\0'; 51 | from_next = from; 52 | to_next = to; 53 | return ok; 54 | } 55 | 56 | virtual std::codecvt_base::result do_out(std::mbstate_t&, 57 | const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, 58 | char* to, char* to_end, char*& to_next) const 59 | { 60 | for (; from != from_end && to != to_end; ++from, ++to) 61 | *to = static_cast(*from - 1); 62 | if (to == to_end) 63 | return error; 64 | *to = '\0'; 65 | from_next = from; 66 | to_next = to; 67 | return ok; 68 | } 69 | 70 | virtual std::codecvt_base::result do_unshift(std::mbstate_t&, 71 | char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; } 72 | 73 | virtual int do_length(std::mbstate_t&, 74 | const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; } 75 | 76 | virtual int do_max_length() const throw () { return 0; } 77 | }; 78 | 79 | #endif // BOOST_FILESYSTEM3_TEST_CODECVT_HPP 80 | -------------------------------------------------------------------------------- /test/windows_attributes.cpp: -------------------------------------------------------------------------------- 1 | // windows_attributes ----------------------------------------------------------------// 2 | 3 | // Copyright Beman Dawes 2010 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 | //--------------------------------------------------------------------------------------// 11 | 12 | // Useful for debugging status related issues // 13 | 14 | //--------------------------------------------------------------------------------------// 15 | 16 | #include 17 | 18 | #ifndef BOOST_LIGHTWEIGHT_MAIN 19 | # include 20 | #else 21 | # include 22 | #endif 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | using std::make_pair; 31 | namespace fs = boost::filesystem; 32 | 33 | int cpp_main( int argc, char* argv[]) 34 | { 35 | typedef std::map decode_type; 36 | decode_type table; 37 | 38 | table.insert(make_pair(FILE_ATTRIBUTE_ARCHIVE, "FILE_ATTRIBUTE_ARCHIVE")); 39 | table.insert(make_pair(FILE_ATTRIBUTE_COMPRESSED, "FILE_ATTRIBUTE_COMPRESSED")); 40 | table.insert(make_pair(FILE_ATTRIBUTE_DEVICE, "FILE_ATTRIBUTE_DEVICE")); 41 | table.insert(make_pair(FILE_ATTRIBUTE_DIRECTORY, "FILE_ATTRIBUTE_DIRECTORY")); 42 | table.insert(make_pair(FILE_ATTRIBUTE_ENCRYPTED, "FILE_ATTRIBUTE_ENCRYPTED")); 43 | table.insert(make_pair(FILE_ATTRIBUTE_HIDDEN, "FILE_ATTRIBUTE_HIDDEN")); 44 | table.insert(make_pair(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, "FILE_ATTRIBUTE_NOT_CONTENT_INDEXED")); 45 | table.insert(make_pair(FILE_ATTRIBUTE_OFFLINE, "FILE_ATTRIBUTE_OFFLINE")); 46 | table.insert(make_pair(FILE_ATTRIBUTE_READONLY, "FILE_ATTRIBUTE_READONLY")); 47 | table.insert(make_pair(FILE_ATTRIBUTE_REPARSE_POINT, "FILE_ATTRIBUTE_REPARSE_POINT")); 48 | table.insert(make_pair(FILE_ATTRIBUTE_SPARSE_FILE, "FILE_ATTRIBUTE_SPARSE_FILE")); 49 | table.insert(make_pair(FILE_ATTRIBUTE_SYSTEM, "FILE_ATTRIBUTE_SYSTEM")); 50 | table.insert(make_pair(FILE_ATTRIBUTE_TEMPORARY, "FILE_ATTRIBUTE_TEMPORARY")); 51 | table.insert(make_pair(FILE_ATTRIBUTE_VIRTUAL, "FILE_ATTRIBUTE_VIRTUAL")); 52 | 53 | if (argc < 2) 54 | { 55 | std::cout << "Usage: windows_attributes path\n"; 56 | return 1; 57 | } 58 | 59 | // report Win32 ::GetFileAttributesA() 60 | 61 | DWORD at(::GetFileAttributesA(argv[1])); 62 | if (at == INVALID_FILE_ATTRIBUTES) 63 | { 64 | std::cout << "GetFileAttributes(\"" << argv[1] 65 | << "\") returned INVALID_FILE_ATTRIBUTES\n"; 66 | return 0; 67 | } 68 | 69 | std::cout << "GetFileAttributes(\"" << argv[1] 70 | << "\") returned "; 71 | 72 | bool bar = false; 73 | for (decode_type::iterator it = table.begin(); it != table.end(); ++it) 74 | { 75 | if (!(it->first & at)) 76 | continue; 77 | if (bar) 78 | std::cout << " | "; 79 | bar = true; 80 | std::cout << it->second; 81 | at &= ~it->first; 82 | } 83 | std::cout << std::endl; 84 | 85 | if (at) 86 | std::cout << "plus unknown attributes " << at << std::endl; 87 | 88 | // report Boost Filesystem file_type 89 | 90 | fs::file_status stat = fs::status(argv[1]); 91 | 92 | const char* types[] = 93 | { 94 | "status_error", 95 | "file_not_found", 96 | "regular_file", 97 | "directory_file", 98 | // the following may not apply to some operating systems or file systems 99 | "symlink_file", 100 | "block_file", 101 | "character_file", 102 | "fifo_file", 103 | "socket_file", 104 | "reparse_file", // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink 105 | "type_unknown", // file does exist", but isn't one of the above types or 106 | // we don't have strong enough permission to find its type 107 | 108 | "_detail_directory_symlink" // internal use only; never exposed to users 109 | }; 110 | 111 | std::cout << "boost::filesystem::status().type() is " << types[stat.type()] << std::endl; 112 | 113 | return 0; 114 | } 115 | -------------------------------------------------------------------------------- /tools/backup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Copyright Beman Dawes 2011 4 | rem Distributed under to the Boost Software License, Version 1.0 5 | rem See http://www.boost.org/LICENSE_1_0.txt 6 | 7 | if not $%1==$ goto ok 8 | :error 9 | echo Usage: backup target-directory-path 10 | goto done 11 | 12 | :ok 13 | mkdir %1\boost\filesystem 2>nul 14 | mkdir %1\libs\filesystem 2>nul 15 | 16 | set BOOST_CURRENT_ROOT=. 17 | :loop 18 | if exist %BOOST_CURRENT_ROOT%\boost-build.jam goto loopend 19 | set BOOST_CURRENT_ROOT=..\%BOOST_CURRENT_ROOT% 20 | goto loop 21 | :loopend 22 | 23 | xcopy /exclude:exclude.txt /y /d /k /r %BOOST_CURRENT_ROOT%\boost\filesystem.hpp %1\boost 24 | xcopy /exclude:exclude.txt /y /d /k /s /r %BOOST_CURRENT_ROOT%\boost\filesystem %1\boost\filesystem 25 | xcopy /exclude:exclude.txt /y /d /k /s /r %BOOST_CURRENT_ROOT%\libs\filesystem %1\libs\filesystem 26 | 27 | :done 28 | -------------------------------------------------------------------------------- /tools/exclude.txt: -------------------------------------------------------------------------------- 1 | .svn 2 | .obj 3 | .exe 4 | .log 5 | .user 6 | .filters 7 | .sdf 8 | .ncb 9 | .ipch 10 | ipch 11 | Debug 12 | Release 13 | v3_operations_test 14 | temp_fs_test_dir 15 | --------------------------------------------------------------------------------