1
0
mirror of https://git.suyu.dev/suyu/suyu synced 2025-09-14 18:17:59 -05:00

Initial commit

This commit is contained in:
Crimson-Hawk
2024-03-05 16:42:40 +08:00
commit f1e4595ebf
39576 changed files with 7006612 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
set(VCPKG_DETECTED_CMAKE_CROSSCOMPILING "OFF")
set(VCPKG_DETECTED_CMAKE_SYSTEM_NAME "Windows")
set(VCPKG_DETECTED_CMAKE_HOST_SYSTEM_NAME "Windows")
set(VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR "AMD64")
set(VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
set(VCPKG_DETECTED_CMAKE_SIZEOF_VOID_P "8")
set(VCPKG_DETECTED_MSVC "1")
set(VCPKG_DETECTED_MSVC_VERSION "1929")
set(VCPKG_DETECTED_CMAKE_AR "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/lib.exe")
set(VCPKG_DETECTED_CMAKE_RANLIB ":")
set(VCPKG_DETECTED_CMAKE_STRIP "")
set(VCPKG_DETECTED_CMAKE_NM "")
set(VCPKG_DETECTED_CMAKE_OBJDUMP "")
set(VCPKG_DETECTED_CMAKE_DLLTOOL "")
set(VCPKG_DETECTED_CMAKE_MT "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64/mt.exe")
set(VCPKG_DETECTED_CMAKE_LINKER "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/link.exe")
set(VCPKG_DETECTED_CMAKE_C_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe")
set(VCPKG_DETECTED_CMAKE_C_COMPILER_ID "MSVC")
set(VCPKG_DETECTED_CMAKE_CXX_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe")
set(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID "MSVC")
set(VCPKG_DETECTED_CMAKE_RC_COMPILER "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64/rc.exe")
set(VCPKG_DETECTED_CMAKE_RC_COMPILER_ID "")
set(VCPKG_DETECTED_CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "")
set(VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
set(VCPKG_DETECTED_CMAKE_C_STANDARD "")
set(VCPKG_DETECTED_CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17")
set(VCPKG_DETECTED_CMAKE_C_EXTENSION "")
set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "")
set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
set(VCPKG_DETECTED_CMAKE_CXX_STANDARD "")
set(VCPKG_DETECTED_CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23")
set(VCPKG_DETECTED_CMAKE_CXX_EXTENSION "")
set(VCPKG_DETECTED_CMAKE_C_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ")
set(VCPKG_DETECTED_CMAKE_CXX_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ")
set(VCPKG_DETECTED_CMAKE_RC_FLAGS "-c65001 /DWIN32")
set(VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS "/machine:x64")
set(VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS "/machine:x64")
set(VCPKG_DETECTED_CMAKE_EXE_LINKER_FLAGS "/machine:x64")
set(VCPKG_DETECTED_ENV_PATH "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE//Extensions/Microsoft/IntelliCode/CLI;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/VC/VCPackages;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TestWindow;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/bin/Roslyn;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Team Tools/Performance Tools/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Team Tools/Performance Tools;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Common/VSPerfCollectionTools/vs2019//x64;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Common/VSPerfCollectionTools/vs2019/;C:/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/x64/;C:/Program Files (x86)/HTML Help Workshop;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/devinit;C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64;C:/Program Files (x86)/Windows Kits/10/bin/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise//MSBuild/Current/Bin;C:/Windows/Microsoft.NET/Framework64/v4.0.30319;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/;C:/Program Files/PowerShell/7;C:/Windows/system32;C:/Windows;C:/Windows/system32/Wbem;C:/Windows/system32/WindowsPowerShell/v1.0/;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/x64/bin;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/VC/Linux/bin/ConnectionManagerExe;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja")
set(VCPKG_DETECTED_ENV_INCLUDE "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/ATLMFC/include;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/include;C:/Program Files (x86)/Windows Kits/NETFXSDK/4.8/include/um;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/ucrt;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/shared;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/um;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/winrt;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/cppwinrt")
set(VCPKG_DETECTED_ENV_C_INCLUDE_PATH "")
set(VCPKG_DETECTED_ENV_CPLUS_INCLUDE_PATH "")
set(VCPKG_DETECTED_ENV_LIB "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/ATLMFC/lib/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x64;C:/Program Files (x86)/Windows Kits/NETFXSDK/4.8/lib/um/x64;C:/Program Files (x86)/Windows Kits/10/lib/10.0.22000.0/ucrt/x64;C:/Program Files (x86)/Windows Kits/10/lib/10.0.22000.0/um/x64")
set(VCPKG_DETECTED_ENV_LIBPATH "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/ATLMFC/lib/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x86/store/references;C:/Program Files (x86)/Windows Kits/10/UnionMetadata/10.0.22000.0;C:/Program Files (x86)/Windows Kits/10/References/10.0.22000.0;C:/Windows/Microsoft.NET/Framework64/v4.0.30319")
set(VCPKG_DETECTED_ENV_LIBRARY_PATH "")
set(VCPKG_DETECTED_ENV_LD_LIBRARY_PATH "")
set(VCPKG_COMBINED_CXX_FLAGS_DEBUG " -nologo -DWIN32 -D_WINDOWS -W3 -utf-8 -GR -EHsc -MP -D_DEBUG -MDd -Z7 -Ob0 -Od -RTC1 ")
set(VCPKG_COMBINED_C_FLAGS_DEBUG " -nologo -DWIN32 -D_WINDOWS -W3 -utf-8 -MP -D_DEBUG -MDd -Z7 -Ob0 -Od -RTC1 ")
set(VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG "-machine:x64 -nologo -debug -INCREMENTAL ")
set(VCPKG_COMBINED_EXE_LINKER_FLAGS_DEBUG "-machine:x64 -nologo -debug -INCREMENTAL ")
set(VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG "-machine:x64 -nologo")
set(VCPKG_COMBINED_RC_FLAGS_DEBUG "-c65001 -DWIN32 -D_DEBUG")

View File

@@ -0,0 +1,50 @@
[1/2] cmd /c "cd .. && "C:/Program Files/CMake/bin/cmake.exe" "D:/a/1/s/build/vcpkg_installed/x64-windows/share/vcpkg-cmake-get-vars/cmake_get_vars" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:/a/1/s/externals/vcpkg/packages/boost-filesystem_x64-windows" "-DCMAKE_MAKE_PROGRAM=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v142" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=D:/a/1/s/externals/vcpkg" "-D_VCPKG_INSTALLED_DIR=D:/a/1/s/build/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-DVCPKG_OUTPUT_FILE:PATH=D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/cmake-get-vars-x64-windows-rel.cmake.log""
-- The C compiler identification is MSVC 19.29.30146.0
-- The CXX compiler identification is MSVC 19.29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_SHARED_LIBS
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
_VCPKG_ROOT_DIR
-- Build files have been written to: D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/x64-windows-rel
[2/2] cmd /c "cd ../../x64-windows-dbg && "C:/Program Files/CMake/bin/cmake.exe" "D:/a/1/s/build/vcpkg_installed/x64-windows/share/vcpkg-cmake-get-vars/cmake_get_vars" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=D:/a/1/s/externals/vcpkg/packages/boost-filesystem_x64-windows/debug" "-DCMAKE_MAKE_PROGRAM=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v142" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=D:/a/1/s/externals/vcpkg" "-D_VCPKG_INSTALLED_DIR=D:/a/1/s/build/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-DVCPKG_OUTPUT_FILE:PATH=D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/cmake-get-vars-x64-windows-dbg.cmake.log""
-- The C compiler identification is MSVC 19.29.30146.0
-- The CXX compiler identification is MSVC 19.29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_SHARED_LIBS
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
_VCPKG_ROOT_DIR
-- Build files have been written to: D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/x64-windows-dbg

View File

@@ -0,0 +1,52 @@
set(VCPKG_DETECTED_CMAKE_CROSSCOMPILING "OFF")
set(VCPKG_DETECTED_CMAKE_SYSTEM_NAME "Windows")
set(VCPKG_DETECTED_CMAKE_HOST_SYSTEM_NAME "Windows")
set(VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR "AMD64")
set(VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
set(VCPKG_DETECTED_CMAKE_SIZEOF_VOID_P "8")
set(VCPKG_DETECTED_MSVC "1")
set(VCPKG_DETECTED_MSVC_VERSION "1929")
set(VCPKG_DETECTED_CMAKE_AR "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/lib.exe")
set(VCPKG_DETECTED_CMAKE_RANLIB ":")
set(VCPKG_DETECTED_CMAKE_STRIP "")
set(VCPKG_DETECTED_CMAKE_NM "")
set(VCPKG_DETECTED_CMAKE_OBJDUMP "")
set(VCPKG_DETECTED_CMAKE_DLLTOOL "")
set(VCPKG_DETECTED_CMAKE_MT "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64/mt.exe")
set(VCPKG_DETECTED_CMAKE_LINKER "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/link.exe")
set(VCPKG_DETECTED_CMAKE_C_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe")
set(VCPKG_DETECTED_CMAKE_C_COMPILER_ID "MSVC")
set(VCPKG_DETECTED_CMAKE_CXX_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe")
set(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID "MSVC")
set(VCPKG_DETECTED_CMAKE_RC_COMPILER "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64/rc.exe")
set(VCPKG_DETECTED_CMAKE_RC_COMPILER_ID "")
set(VCPKG_DETECTED_CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "")
set(VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
set(VCPKG_DETECTED_CMAKE_C_STANDARD "")
set(VCPKG_DETECTED_CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17")
set(VCPKG_DETECTED_CMAKE_C_EXTENSION "")
set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "")
set(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
set(VCPKG_DETECTED_CMAKE_CXX_STANDARD "")
set(VCPKG_DETECTED_CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23")
set(VCPKG_DETECTED_CMAKE_CXX_EXTENSION "")
set(VCPKG_DETECTED_CMAKE_C_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ")
set(VCPKG_DETECTED_CMAKE_CXX_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ")
set(VCPKG_DETECTED_CMAKE_RC_FLAGS "-c65001 /DWIN32")
set(VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS "/machine:x64")
set(VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS "/machine:x64")
set(VCPKG_DETECTED_CMAKE_EXE_LINKER_FLAGS "/machine:x64")
set(VCPKG_DETECTED_ENV_PATH "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE//Extensions/Microsoft/IntelliCode/CLI;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/VC/VCPackages;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TestWindow;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/bin/Roslyn;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Team Tools/Performance Tools/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Team Tools/Performance Tools;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Common/VSPerfCollectionTools/vs2019//x64;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Common/VSPerfCollectionTools/vs2019/;C:/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/x64/;C:/Program Files (x86)/HTML Help Workshop;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/devinit;C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x64;C:/Program Files (x86)/Windows Kits/10/bin/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise//MSBuild/Current/Bin;C:/Windows/Microsoft.NET/Framework64/v4.0.30319;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/;C:/Program Files/PowerShell/7;C:/Windows/system32;C:/Windows;C:/Windows/system32/Wbem;C:/Windows/system32/WindowsPowerShell/v1.0/;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/x64/bin;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/VC/Linux/bin/ConnectionManagerExe;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja")
set(VCPKG_DETECTED_ENV_INCLUDE "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/ATLMFC/include;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/include;C:/Program Files (x86)/Windows Kits/NETFXSDK/4.8/include/um;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/ucrt;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/shared;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/um;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/winrt;C:/Program Files (x86)/Windows Kits/10/include/10.0.22000.0/cppwinrt")
set(VCPKG_DETECTED_ENV_C_INCLUDE_PATH "")
set(VCPKG_DETECTED_ENV_CPLUS_INCLUDE_PATH "")
set(VCPKG_DETECTED_ENV_LIB "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/ATLMFC/lib/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x64;C:/Program Files (x86)/Windows Kits/NETFXSDK/4.8/lib/um/x64;C:/Program Files (x86)/Windows Kits/10/lib/10.0.22000.0/ucrt/x64;C:/Program Files (x86)/Windows Kits/10/lib/10.0.22000.0/um/x64")
set(VCPKG_DETECTED_ENV_LIBPATH "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/ATLMFC/lib/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x64;C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x86/store/references;C:/Program Files (x86)/Windows Kits/10/UnionMetadata/10.0.22000.0;C:/Program Files (x86)/Windows Kits/10/References/10.0.22000.0;C:/Windows/Microsoft.NET/Framework64/v4.0.30319")
set(VCPKG_DETECTED_ENV_LIBRARY_PATH "")
set(VCPKG_DETECTED_ENV_LD_LIBRARY_PATH "")
set(VCPKG_COMBINED_CXX_FLAGS_RELEASE " -nologo -DWIN32 -D_WINDOWS -W3 -utf-8 -GR -EHsc -MP -MD -O2 -Oi -Gy -DNDEBUG -Z7 ")
set(VCPKG_COMBINED_C_FLAGS_RELEASE " -nologo -DWIN32 -D_WINDOWS -W3 -utf-8 -MP -MD -O2 -Oi -Gy -DNDEBUG -Z7 ")
set(VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE "-machine:x64 -nologo -DEBUG -INCREMENTAL:NO -OPT:REF -OPT:ICF ")
set(VCPKG_COMBINED_EXE_LINKER_FLAGS_RELEASE "-machine:x64 -nologo -DEBUG -INCREMENTAL:NO -OPT:REF -OPT:ICF ")
set(VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE "-machine:x64 -nologo")
set(VCPKG_COMBINED_RC_FLAGS_RELEASE "-c65001 -DWIN32 ")

View File

@@ -0,0 +1,2 @@
include("${CMAKE_CURRENT_LIST_DIR}/cmake-get-vars-x64-windows-rel.cmake.log")
include("${CMAKE_CURRENT_LIST_DIR}/cmake-get-vars-x64-windows-dbg.cmake.log")

View File

@@ -0,0 +1,26 @@
[1/2] cmd /c "cd ../../x64-windows-dbg && "C:/Program Files/CMake/bin/cmake.exe" "D:/a/1/s/build/vcpkg_installed/x64-windows/share/boost-build" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=D:/a/1/s/externals/vcpkg/packages/boost-filesystem_x64-windows/debug" "-DPORT=boost-filesystem" "-DFEATURES=core" "-DWITH_PYTHON2=OFF" "-DWITH_PYTHON3=OFF" "-DCURRENT_INSTALLED_DIR=D:/a/1/s/build/vcpkg_installed/x64-windows" "-DB2_EXE=D:/a/1/s/build/vcpkg_installed/x64-windows/tools/boost-build/b2.exe" "-DSOURCE_PATH=D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/src/ost-1.79.0-f01c77d79c.clean" "-DBOOST_BUILD_PATH=D:/a/1/s/build/vcpkg_installed/x64-windows/tools/boost-build" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_CMAKE_VARS_FILE=D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/cmake-get-vars-x64-windows.cmake.log" "-DCMAKE_MAKE_PROGRAM=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v142" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=D:/a/1/s/externals/vcpkg" "-D_VCPKG_INSTALLED_DIR=D:/a/1/s/build/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF""
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
FEATURES
_VCPKG_ROOT_DIR
-- Build files have been written to: D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/x64-windows-dbg
[2/2] cmd /c "cd .. && "C:/Program Files/CMake/bin/cmake.exe" "D:/a/1/s/build/vcpkg_installed/x64-windows/share/boost-build" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=D:/a/1/s/externals/vcpkg/packages/boost-filesystem_x64-windows" "-DPORT=boost-filesystem" "-DFEATURES=core" "-DWITH_PYTHON2=OFF" "-DWITH_PYTHON3=OFF" "-DCURRENT_INSTALLED_DIR=D:/a/1/s/build/vcpkg_installed/x64-windows" "-DB2_EXE=D:/a/1/s/build/vcpkg_installed/x64-windows/tools/boost-build/b2.exe" "-DSOURCE_PATH=D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/src/ost-1.79.0-f01c77d79c.clean" "-DBOOST_BUILD_PATH=D:/a/1/s/build/vcpkg_installed/x64-windows/tools/boost-build" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_CMAKE_VARS_FILE=D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/cmake-get-vars-x64-windows.cmake.log" "-DCMAKE_MAKE_PROGRAM=C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v142" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=D:/a/1/s/externals/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=D:/a/1/s/externals/vcpkg" "-D_VCPKG_INSTALLED_DIR=D:/a/1/s/build/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF""
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
FEATURES
_VCPKG_ROOT_DIR
-- Build files have been written to: D:/a/1/s/externals/vcpkg/buildtrees/boost-filesystem/x64-windows-rel

View File

View File

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile.v2 text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain

View File

@@ -0,0 +1,478 @@
# Copyright 2021 Andrey Semashev
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
env:
GIT_FETCH_JOBS: 8
NET_RETRY_COUNT: 5
DEFAULT_BUILD_VARIANT: debug,release
jobs:
posix:
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
# Linux, gcc
- toolset: gcc-4.4
cxxstd: "98,0x"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- g++-4.4
sources:
- "ppa:ubuntu-toolchain-r/test"
- toolset: gcc-4.6
cxxstd: "03,0x"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- g++-4.6
sources:
- "ppa:ubuntu-toolchain-r/test"
- toolset: gcc-4.7
cxxstd: "03,11"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- g++-4.7
- toolset: gcc-4.8
cxxstd: "03,11"
os: ubuntu-18.04
install:
- g++-4.8
- toolset: gcc-4.9
cxxstd: "03,11"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- g++-4.9
extra_tests: 1
- toolset: gcc-5
cxxstd: "03,11,14,1z"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- g++-5
- toolset: gcc-6
cxxstd: "03,11,14,1z"
os: ubuntu-18.04
install:
- g++-6
- toolset: gcc-7
cxxstd: "03,11,14,17"
os: ubuntu-18.04
install:
- g++-7
- toolset: gcc-8
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
install:
- g++-8
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
install:
- g++-9
- toolset: gcc-10
cxxstd: "03,11,14,17,20"
os: ubuntu-20.04
install:
- g++-10
- toolset: gcc-11
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
os: ubuntu-20.04
install:
- g++-11
sources:
- "ppa:ubuntu-toolchain-r/test"
- name: UBSAN
toolset: gcc-11
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
ubsan: 1
build_variant: debug
os: ubuntu-20.04
install:
- g++-11
sources:
- "ppa:ubuntu-toolchain-r/test"
# Linux, clang
- toolset: clang
compiler: clang++-3.5
cxxstd: "03,11"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- clang-3.5
- toolset: clang
compiler: clang++-3.6
cxxstd: "03,11,14"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- clang-3.6
- toolset: clang
compiler: clang++-3.7
cxxstd: "03,11,14"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- clang-3.7
- toolset: clang
compiler: clang++-3.8
cxxstd: "03,11,14"
os: ubuntu-20.04
container: ubuntu:16.04
install:
- clang-3.8
- toolset: clang
compiler: clang++-3.9
cxxstd: "03,11,14"
os: ubuntu-18.04
install:
- clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "03,11,14"
os: ubuntu-18.04
install:
- clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "03,11,14,1z"
os: ubuntu-18.04
install:
- clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "03,11,14,17"
os: ubuntu-18.04
install:
- clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "03,11,14,17"
os: ubuntu-18.04
install:
- clang-7
# Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode
- toolset: clang
compiler: clang++-8
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
install:
- clang-8
- g++-7
gcc_toolchain: 7
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install:
- clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,20"
os: ubuntu-20.04
install:
- clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,20"
os: ubuntu-20.04
install:
- clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
os: ubuntu-20.04
install:
- clang-12
- toolset: clang
compiler: clang++-12
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
os: ubuntu-20.04
install:
- clang-12
- libc++-12-dev
- libc++abi-12-dev
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
- toolset: clang
compiler: clang++-13
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
os: ubuntu-20.04
install:
- clang-13
sources:
- "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"
source_keys:
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
- toolset: clang
compiler: clang++-13
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
os: ubuntu-20.04
install:
- clang-13
- libc++-13-dev
- libc++abi-13-dev
sources:
- "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"
source_keys:
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
- name: UBSAN
toolset: clang
compiler: clang++-12
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu"
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
ubsan: 1
build_variant: debug
os: ubuntu-20.04
install:
- clang-12
- libc++-12-dev
- libc++abi-12-dev
- toolset: clang
cxxstd: "03,11,14,17,2a"
os: macos-10.15
- name: CMake tests
cmake_tests: 1
os: ubuntu-20.04
timeout-minutes: 60
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
steps:
- name: Setup environment
run: |
if [ -f "/etc/debian_version" ]
then
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
export DEBIAN_FRONTEND=noninteractive
fi
if [ -n "${{matrix.container}}" ]
then
echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV
if [ -f "/etc/debian_version" ]
then
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 perl git cmake
fi
fi
git config --global pack.threads 0
- uses: actions/checkout@v2
- name: Install packages
if: matrix.install
run: |
declare -a SOURCE_KEYS SOURCES
if [ -n "${{join(matrix.source_keys, ' ')}}" ]
then
SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}")
fi
if [ -n "${{join(matrix.sources, ' ')}}" ]
then
SOURCES=("${{join(matrix.sources, '" "')}}")
fi
for key in "${SOURCE_KEYS[@]}"
do
for i in {1..$NET_RETRY_COUNT}
do
echo "Adding key: $key"
wget -O - "$key" | sudo apt-key add - && break || sleep 2
done
done
if [ ${#SOURCES[@]} -gt 0 ]
then
APT_ADD_REPO_COMMON_ARGS=("-y")
APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')"
if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ]
then
APT_ADD_REPO_COMMON_ARGS+=("-n")
fi
APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)"
for source in "${SOURCES[@]}"
do
for i in {1..$NET_RETRY_COUNT}
do
APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}")
if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ]
then
case "$source" in
"ppa:"*)
APT_ADD_REPO_ARGS+=("-P")
;;
"deb "*)
APT_ADD_REPO_ARGS+=("-S")
;;
*)
APT_ADD_REPO_ARGS+=("-U")
;;
esac
fi
APT_ADD_REPO_ARGS+=("$source")
echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}"
sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2
done
done
fi
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}}
- name: Setup GCC Toolchain
if: matrix.gcc_toolchain
run: |
GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain"
echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV
MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
mkdir -p "$GCC_TOOLCHAIN_ROOT"
ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include"
ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin"
mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET"
ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}"
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
DEPINST_ARGS=()
GIT_VERSION="$(git --version | sed -e 's/git version //')"
GIT_HAS_JOBS=1
if [ -f "/etc/debian_version" ]
then
if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0)
then
GIT_HAS_JOBS=0
fi
else
declare -a GIT_VER=(${GIT_VERSION//./ })
declare -a GIT_MIN_VER=(2 8 0)
for ((i=0; i<${#GIT_VER[@]}; i++))
do
if [ -z "${GIT_MIN_VER[i]}" ]
then
GIT_MIN_VER[i]=0
fi
if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ]
then
GIT_HAS_JOBS=0
break
fi
done
fi
if [ "$GIT_HAS_JOBS" -ne 0 ]
then
DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
fi
cd ..
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
cd boost-root
mkdir -p libs/$LIBRARY
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
if [ -n "${{matrix.extra_tests}}" ]
then
DEPINST_ARGS+=("--include" "example")
fi
DEPINST_ARGS+=("$LIBRARY")
python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
if [ -z "${{matrix.cmake_tests}}" ]
then
./bootstrap.sh
./b2 headers
if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ]
then
echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam
if [ -n "$GCC_TOOLCHAIN_ROOT" ]
then
echo -n " : <compileflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" <linkflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam
fi
echo " ;" >> ~/user-config.jam
fi
fi
- name: Run tests
if: matrix.cmake_tests == ''
run: |
cd ../boost-root
if [ -n "${{matrix.extra_tests}}" ]
then
export BOOST_FILESYSTEM_TEST_WITH_EXAMPLES=1
fi
B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}")
if [ -n "${{matrix.build_variant}}" ]
then
B2_ARGS+=("variant=${{matrix.build_variant}}")
else
B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT")
fi
if [ -n "${{matrix.threading}}" ]
then
B2_ARGS+=("threading=${{matrix.threading}}")
fi
if [ -n "${{matrix.ubsan}}" ]
then
export UBSAN_OPTIONS="print_stacktrace=1"
B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
fi
if [ -n "${{matrix.cxxflags}}" ]
then
B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
fi
if [ -n "${{matrix.linkflags}}" ]
then
B2_ARGS+=("linkflags=${{matrix.linkflags}}")
fi
B2_ARGS+=("libs/$LIBRARY/test")
./b2 "${B2_ARGS[@]}"
- name: Run CMake tests
if: matrix.cmake_tests
run: |
cd ../boost-root
mkdir __build_static__ && cd __build_static__
cmake ../libs/$LIBRARY/test/test_cmake
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
cd ..
mkdir __build_shared__ && cd __build_shared__
cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS

View File

@@ -0,0 +1,46 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# IDE generated files #
#######################
# Visual Studio
Debug
Release
.sdf
.suo

View File

@@ -0,0 +1,205 @@
# Copyright 2019 Mike Dev
# Copyright 2020-2022 Andrey Semashev
#
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
#
# NOTE: CMake support for Boost.Filesystem is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required(VERSION 3.5)
project(BoostFilesystem VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
include(CheckCXXSourceCompiles)
set(BOOST_FILESYSTEM_NO_DEPRECATED OFF CACHE BOOL "Disable deprecated functionality of Boost.Filesystem")
set(BOOST_FILESYSTEM_DISABLE_SENDFILE OFF CACHE BOOL "Disable usage of sendfile API in Boost.Filesystem")
set(BOOST_FILESYSTEM_DISABLE_COPY_FILE_RANGE OFF CACHE BOOL "Disable usage of copy_file_range API in Boost.Filesystem")
set(BOOST_FILESYSTEM_DISABLE_STATX OFF CACHE BOOL "Disable usage of statx API in Boost.Filesystem")
set(BOOST_FILESYSTEM_DISABLE_GETRANDOM OFF CACHE BOOL "Disable usage of getrandom API in Boost.Filesystem")
set(BOOST_FILESYSTEM_DISABLE_ARC4RANDOM OFF CACHE BOOL "Disable usage of arc4random API in Boost.Filesystem")
set(BOOST_FILESYSTEM_DISABLE_BCRYPT OFF CACHE BOOL "Disable usage of BCrypt API in Boost.Filesystem")
# Note: We can't use the Boost::library targets in the configure checks as they may not yet be included
# by the superproject when this CMakeLists.txt is included. We also don't want to hardcode include paths
# of the needed libraries and their dependencies, recursively, as this is too fragile and requires maintenance.
# Instead, we collect include paths of all libraries and use them in the configure checks. This works faster
# if there is a unified Boost include tree in the filesystem (i.e. if `b2 headers` was run or we're in the
# official monolithic Boost distribution tree).
include(cmake/BoostLibraryIncludes.cmake)
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/src" ${BOOST_LIBRARY_INCLUDES})
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_attribute_init_priority.cpp>" BOOST_FILESYSTEM_HAS_INIT_PRIORITY)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_cxx20_atomic_ref.cpp>" BOOST_FILESYSTEM_HAS_CXX20_ATOMIC_REF)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_blksize.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_mtim.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_MTIM)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_mtimensec.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_mtimespec.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_birthtimensec.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMENSEC)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_birthtimespec.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMESPEC)
if(NOT BOOST_FILESYSTEM_DISABLE_STATX)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_statx.cpp>" BOOST_FILESYSTEM_HAS_STATX)
if(NOT BOOST_FILESYSTEM_HAS_STATX)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_statx_syscall.cpp>" BOOST_FILESYSTEM_HAS_STATX_SYSCALL)
endif()
endif()
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_fdopendir_nofollow.cpp>" BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW)
if(WIN32 AND NOT BOOST_FILESYSTEM_DISABLE_BCRYPT)
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_bcrypt.cpp>" BOOST_FILESYSTEM_HAS_BCRYPT)
unset(CMAKE_REQUIRED_LIBRARIES)
endif()
unset(CMAKE_REQUIRED_INCLUDES)
set(BOOST_FILESYSTEM_SOURCES
src/codecvt_error_category.cpp
src/exception.cpp
src/operations.cpp
src/directory.cpp
src/path.cpp
src/path_traits.cpp
src/portability.cpp
src/unique_path.cpp
src/utf8_codecvt_facet.cpp
)
if(WIN32 OR CYGWIN)
list(APPEND BOOST_FILESYSTEM_SOURCES src/windows_file_codecvt.cpp)
endif()
add_library(boost_filesystem ${BOOST_FILESYSTEM_SOURCES})
add_library(Boost::filesystem ALIAS boost_filesystem)
target_include_directories(boost_filesystem PUBLIC include)
target_include_directories(boost_filesystem PRIVATE src)
target_compile_definitions(boost_filesystem
PUBLIC
# NOTE:
# We deactivate autolinking, because cmake based builds don't need it
# and we don't implement name mangling for the library file anyway.
# Ususally the parent CMakeLists.txt file should already have globally defined BOOST_ALL_NO_LIB
BOOST_FILESYSTEM_NO_LIB
$<$<STREQUAL:$<TARGET_PROPERTY:boost_filesystem,TYPE>,SHARED_LIBRARY>:BOOST_FILESYSTEM_DYN_LINK=1>
$<$<STREQUAL:$<TARGET_PROPERTY:boost_filesystem,TYPE>,STATIC_LIBRARY>:BOOST_FILESYSTEM_STATIC_LINK=1>
PRIVATE
BOOST_FILESYSTEM_SOURCE
)
if(WIN32)
target_compile_definitions(boost_filesystem PRIVATE
_SCL_SECURE_NO_WARNINGS
_SCL_SECURE_NO_DEPRECATE
_CRT_SECURE_NO_WARNINGS
_CRT_SECURE_NO_DEPRECATE
)
endif()
if(WIN32 OR CYGWIN)
target_compile_definitions(boost_filesystem PRIVATE
BOOST_USE_WINDOWS_H
WIN32_LEAN_AND_MEAN
NOMINMAX
)
endif()
if(BOOST_FILESYSTEM_NO_DEPRECATED)
target_compile_definitions(boost_filesystem PUBLIC BOOST_FILESYSTEM_NO_DEPRECATED)
endif()
if(BOOST_FILESYSTEM_HAS_INIT_PRIORITY)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_INIT_PRIORITY)
endif()
if(BOOST_FILESYSTEM_DISABLE_SENDFILE)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_DISABLE_SENDFILE)
endif()
if(BOOST_FILESYSTEM_DISABLE_COPY_FILE_RANGE)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_DISABLE_COPY_FILE_RANGE)
endif()
if(BOOST_FILESYSTEM_DISABLE_STATX)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_DISABLE_STATX)
endif()
if(BOOST_FILESYSTEM_DISABLE_GETRANDOM)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_DISABLE_GETRANDOM)
endif()
if(BOOST_FILESYSTEM_DISABLE_ARC4RANDOM)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_DISABLE_ARC4RANDOM)
endif()
if(BOOST_FILESYSTEM_DISABLE_BCRYPT)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_DISABLE_BCRYPT)
endif()
if(BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE)
endif()
if(BOOST_FILESYSTEM_HAS_STAT_ST_MTIM)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STAT_ST_MTIM)
endif()
if(BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC)
endif()
if(BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC)
endif()
if(BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMENSEC)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMENSEC)
endif()
if(BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMESPEC)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMESPEC)
endif()
if(BOOST_FILESYSTEM_HAS_STATX)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STATX)
endif()
if(BOOST_FILESYSTEM_HAS_STATX_SYSCALL)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_STATX_SYSCALL)
endif()
if(BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW)
endif()
target_link_libraries(boost_filesystem
PUBLIC
Boost::assert
Boost::config
Boost::container_hash
Boost::core
Boost::detail
Boost::io
Boost::iterator
Boost::smart_ptr
Boost::system
Boost::type_traits
PRIVATE
Boost::predef
)
if(NOT BOOST_FILESYSTEM_HAS_CXX20_ATOMIC_REF)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)
target_link_libraries(boost_filesystem
PRIVATE
Boost::atomic
)
endif()
if(WIN32)
if(BOOST_FILESYSTEM_HAS_BCRYPT)
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_BCRYPT)
target_link_libraries(boost_filesystem PRIVATE bcrypt)
else()
target_compile_definitions(boost_filesystem PRIVATE BOOST_FILESYSTEM_HAS_WINCRYPT)
if(NOT WINCE)
target_link_libraries(boost_filesystem PRIVATE advapi32)
else()
target_link_libraries(boost_filesystem PRIVATE coredll)
endif()
endif()
target_link_libraries(boost_filesystem
PRIVATE
Boost::winapi
)
endif()

View File

@@ -0,0 +1,180 @@
constant BOOST_VERSION : 1.79.0 ;
constant BOOST_VERSION_ABI_TAG : 1_79 ;
constant BOOST_JAMROOT_MODULE : $(__name__) ;
import boostcpp ;
import feature ;
boostcpp.set-version $(BOOST_VERSION) ;
project boost : requirements
<include>include&&"D:/a/1/s/build/vcpkg_installed/x64-windows/include"
<define>BOOST_ALL_NO_LIB=1
<tag>@$(__name__).tag
;
rule boost-install ( libraries * )
{
stagedir = [ option.get stagedir ] ;
install stage
: $(libraries)
: <location>$(stagedir)/lib ;
}
rule tag ( name : type ? : property-set )
{
return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
}
rule python-tag ( name : type ? : property-set )
{
return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
}
if "boost-filesystem" != "boost-system"
{
use-project /boost/system : . ;
lib boost_system : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_system-vc140-mt.lib" <variant>release ;
lib boost_system : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_system-vc140-mt-gd.lib" <variant>debug ;
explicit boost_system ;
use-project /boost : . ;
alias system : boost_system ;
}
if "boost-filesystem" != "boost-chrono"
{
use-project /boost/chrono : . ;
lib boost_chrono : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_chrono-vc140-mt.lib" <variant>release ;
lib boost_chrono : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_chrono-vc140-mt-gd.lib" <variant>debug ;
explicit boost_chrono ;
}
if "boost-filesystem" != "boost-regex"
{
use-project /boost/regex : . ;
lib boost_regex : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_regex-vc140-mt.lib" <variant>release ;
lib boost_regex : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_regex-vc140-mt-gd.lib" <variant>debug ;
explicit boost_regex ;
}
if "boost-filesystem" != "boost-date-time"
{
use-project /boost/date_time : . ;
lib boost_date_time : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_date_time-vc140-mt.lib" <variant>release -<library>/boost/date_time//boost_date_time ;
lib boost_date_time : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_date_time-vc140-mt-gd.lib" <variant>debug -<library>/boost/date_time//boost_date_time ;
explicit boost_date_time ;
}
if "boost-filesystem" != "boost-thread"
{
use-project /boost/thread : . ;
lib boost_thread : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_thread-vc140-mt.lib" <variant>release : : <library>/boost/date_time//boost_date_time ;
lib boost_thread : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_thread-vc140-mt-gd.lib" <variant>debug : : <library>/boost/date_time//boost_date_time ;
explicit boost_thread ;
}
if "boost-filesystem" != "boost-timer"
{
use-project /boost/timer : . ;
lib boost_timer : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_timer-vc140-mt.lib" <variant>release ;
lib boost_timer : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_timer-vc140-mt-gd.lib" <variant>debug ;
explicit boost_timer ;
}
if "boost-filesystem" != "boost-filesystem"
{
use-project /boost/filesystem : . ;
lib boost_filesystem : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_filesystem-vc140-mt.lib" <variant>release : : <library>/boost/system//boost_system ;
lib boost_filesystem : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_filesystem-vc140-mt-gd.lib" <variant>debug : : <library>/boost/system//boost_system ;
explicit boost_filesystem ;
}
if "boost-filesystem" != "boost-atomic"
{
use-project /boost/atomic : . ;
lib boost_atomic : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_atomic-vc140-mt.lib" <variant>release ;
lib boost_atomic : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_atomic-vc140-mt-gd.lib" <variant>debug ;
explicit boost_atomic ;
}
if "boost-filesystem" != "boost-context"
{
feature.feature segmented-stacks : on : optional propagated composite ;
feature.compose <segmented-stacks>on : <define>BOOST_USE_SEGMENTED_STACKS ;
use-project /boost/context : . ;
lib boost_context : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_context-vc140-mt.lib" <variant>release ;
lib boost_context : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_context-vc140-mt-gd.lib" <variant>debug ;
explicit boost_context ;
}
if "boost-filesystem" != "boost-test"
{
use-project /boost/test : . ;
lib boost_unit_test_framework : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_unit_test_framework-vc140-mt.lib" <variant>release ;
lib boost_unit_test_framework : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_unit_test_framework-vc140-mt-gd.lib" <variant>debug ;
explicit boost_unit_test_framework ;
}
if "boost-filesystem" != "boost-serialization"
{
use-project /boost/serialization : . ;
lib boost_serialization : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_serialization-vc140-mt.lib" <variant>release ;
lib boost_serialization : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_serialization-vc140-mt-gd.lib" <variant>debug ;
explicit boost_serialization ;
}
if "boost-filesystem" != "boost-mpi"
{
use-project /boost/mpi : . ;
lib boost_mpi : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_mpi-vc140-mt.lib" <variant>release : : <library>/boost/serialization//boost_serialization ;
lib boost_mpi : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_mpi-vc140-mt-gd.lib" <variant>debug : : <library>/boost/serialization//boost_serialization ;
explicit boost_mpi ;
}
if "boost-filesystem" != "boost-container"
{
use-project /boost/container : . ;
lib boost_container : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_container-vc140-mt.lib" <variant>release ;
lib boost_container : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_container-vc140-mt-gd.lib" <variant>debug ;
explicit boost_container ;
}
if "boost-filesystem" != "boost-python"
{
use-project /boost/python : . ;
lib boost_python : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/lib/boost_python-vc140-mt.lib" <variant>release ;
lib boost_python : : <file>"D:/a/1/s/build/vcpkg_installed/x64-windows/debug/lib/boost_python-vc140-mt-gd.lib" <variant>debug ;
explicit boost_python ;
}
rule requires ( foo * )
{
}
rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
{
name = boost_$(name) ;
lib $(name) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ;
boost-install $(name) ;
}
use-project /boost/boost-filesystem : build ;
build-project build ;

View File

@@ -0,0 +1,28 @@
# Boost.Filesystem
Boost.Filesystem, part of collection of the [Boost C++ Libraries](https://github.com/boostorg), provides facilities to manipulate files and directories, and the paths that identify them.
### Directories
* **doc** - Documentation sources
* **include** - Interface headers of Boost.Filesystem
* **src** - Compilable source files of Boost.Filesystem
* **test** - Boost.Filesystem unit tests
* **example** - Boost.Filesystem usage examples
### More information
* [Documentation](https://boost.org/libs/filesystem)
* [Report bugs](https://github.com/boostorg/filesystem/issues/new). Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
* Submit your patches as [pull requests](https://github.com/boostorg/filesystem/compare) against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).
### Build status
Branch | GitHub Actions | AppVeyor | Test Matrix | Dependencies |
:-------------: | -------------- | -------- | ----------- | ------------ |
[`master`](https://github.com/boostorg/filesystem/tree/master) | [![GitHub Actions](https://github.com/boostorg/filesystem/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/filesystem/actions?query=branch%3Amaster) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/nx3e7bcavvn3q953/branch/master?svg=true)](https://ci.appveyor.com/project/Lastique/filesystem/branch/master) | [![Tests](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/filesystem.html) | [![Dependencies](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/filesystem.html)
[`develop`](https://github.com/boostorg/filesystem/tree/develop) | [![GitHub Actions](https://github.com/boostorg/filesystem/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/filesystem/actions?query=branch%3Adevelop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/nx3e7bcavvn3q953/branch/develop?svg=true)](https://ci.appveyor.com/project/Lastique/filesystem/branch/develop) | [![Tests](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/filesystem.html) | [![Dependencies](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/filesystem.html)
### License
Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).

View File

@@ -0,0 +1,119 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2019 - 2021 Andrey Semashev
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
- /feature\/.*/
environment:
matrix:
- TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
ADDRMD: 32
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: msvc-14.0
ADDRMD: 32,64
EXTRA_TESTS: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: msvc-14.1
CXXSTD: 14,17
ADDRMD: 32,64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- TOOLSET: msvc-14.2
ADDRMD: 32,64
CXXSTD: 14,17
THREADING: single,multi
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- TOOLSET: clang-win
ADDRMD: 32
CXXSTD: 14,17
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- TOOLSET: clang-win
ADDRMD: 64
CXXSTD: 14,17
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\cygwin\bin;
THREADING: single,multi
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\cygwin64\bin;
EXTRA_TESTS: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\mingw\bin;
EXTRA_TESTS: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
EXTRA_TESTS: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,17
ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;
THREADING: single,multi
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,17,2a
ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;
THREADING: single,multi
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TEST_CMAKE: 1
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
install:
- set GIT_FETCH_JOBS=8
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init tools/build
- git submodule init tools/boostdep
- git submodule init tools/boost_install
- git submodule init libs/headers
- git submodule init libs/config
- git submodule update --jobs %GIT_FETCH_JOBS%
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\filesystem
- if not "%EXTRA_TESTS%" == "" set DEPINST_ARG_INCLUDE_EXAMPLES="--include=example"
- python tools/boostdep/depinst/depinst.py %DEPINST_ARG_INCLUDE_EXAMPLES% --git_args "--jobs %GIT_FETCH_JOBS%" filesystem
- cmd /c bootstrap
- b2 -d0 headers
build: off
test_script:
- PATH=%ADDPATH%%PATH%
- if not "%ENV_SCRIPT%" == "" call "%ENV_SCRIPT%"
- if not "%EXTRA_TESTS%" == "" set BOOST_FILESYSTEM_TEST_WITH_EXAMPLES=1
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- if not "%THREADING%" == "" set THREADING=threading=%THREADING%
- b2 -j %NUMBER_OF_PROCESSORS% libs/filesystem/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% %THREADING%
for:
- matrix:
only: [TEST_CMAKE: 1]
test_script:
- mkdir __build_static__
- cd __build_static__
- cmake ../libs/filesystem/test/test_cmake
- cmake --build . --target boost_filesystem_cmake_self_test -j %NUMBER_OF_PROCESSORS%
- cd ..
- mkdir __build_shared__
- cd __build_shared__
- cmake -DBUILD_SHARED_LIBS=On ../libs/filesystem/test/test_cmake
- cmake --build . --target boost_filesystem_cmake_self_test -j %NUMBER_OF_PROCESSORS%

View File

@@ -0,0 +1,17 @@
# Boost Filesystem Library Bug report Jamfile
# Copyright Beman Dawes 2014
# Distributed under the Boost Software License, Version 1.0.
# See www.boost.org/LICENSE_1_0.txt
# Library home page: http://www.boost.org/libs/filesystem
project
: requirements
<library>/boost/filesystem//boost_filesystem
;
exe bug : bug.cpp : <link>static ;
# install in ./bin; invoke via "b2", not "b2 install"
install bin : bug ;

View File

@@ -0,0 +1,19 @@
// filesystem/bug/bug.cpp
#include <boost/detail/lightweight_test_report.hpp>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
int test_main(int, char*[]) // note name
{
BOOST_TEST(2 + 2 == 5); // one convertible-to-bool argument
BOOST_TEST_EQ(4 + 4, 9); // two EqualityComparible arguments
BOOST_TEST(fs::exists(".")); // should pass, so nothing reported
return ::boost::report_errors(); // required
}
// Copyright Beman Dawes 2014
// Distributed under the Boost Software License, Version 1.0.
// www.boost.org/LICENSE_1_0.txt

View File

@@ -0,0 +1,13 @@
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../doc/issue_reporting.html">
</head>
<body>
Automatic redirection failed, please go to
<a href="../doc/issue_reporting.html">../doc/issue_reporting.html</a>.
<hr>
<p>&copy; Copyright Beman Dawes, 2014</p>
<p> Distributed under the Boost Software License, Version 1.0.
See http://www.boost.org/LICENSE_1_0.txt</p>
</body>
</html>

View File

@@ -0,0 +1,170 @@
# Boost Filesystem Library Build Jamfile
# (C) Copyright Beman Dawes 2002-2006
# (C) Copyright Andrey Semashev 2020, 2021
# Distributed under the Boost Software License, Version 1.0.
# See www.boost.org/LICENSE_1_0.txt
# See library home page at http://www.boost.org/libs/filesystem
import project ;
import configure ;
lib bcrypt ;
lib advapi32 ;
lib coredll ;
explicit bcrypt advapi32 coredll ;
# The rule checks if a config macro is defined in the command line or build properties
rule has-config-flag ( flag : properties * )
{
if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) )
{
return 1 ;
}
else
{
return ;
}
}
# The rule checks we're building for Windows and selects crypto API to be used
rule select-windows-crypto-api ( properties * )
{
local result ;
if <target-os>windows in $(properties) || <target-os>cygwin in $(properties)
{
if ! [ has-config-flag BOOST_FILESYSTEM_DISABLE_BCRYPT : $(properties) ] &&
[ configure.builds ../config//has_bcrypt : $(properties) : "has BCrypt API" ]
{
result = <define>BOOST_FILESYSTEM_HAS_BCRYPT <library>bcrypt ;
}
else
{
result = <define>BOOST_FILESYSTEM_HAS_WINCRYPT ;
if [ configure.builds ../config//is_windows_ce : $(properties) : "is Windows CE" ]
{
result += <library>coredll ;
}
else
{
result += <library>advapi32 ;
}
}
}
#ECHO Result: $(result) ;
return $(result) ;
}
# The rule checks if statx syscall is supported
rule check-statx ( properties * )
{
local result ;
if ! [ has-config-flag BOOST_FILESYSTEM_DISABLE_STATX : $(properties) ]
{
if [ configure.builds ../config//has_statx : $(properties) : "has statx" ]
{
result = <define>BOOST_FILESYSTEM_HAS_STATX ;
}
else if [ configure.builds ../config//has_statx_syscall : $(properties) : "has statx syscall" ]
{
result = <define>BOOST_FILESYSTEM_HAS_STATX_SYSCALL ;
}
}
#ECHO Result: $(result) ;
return $(result) ;
}
# The rule checks if std::atomic_ref is supported
rule check-cxx20-atomic-ref ( properties * )
{
local result ;
if ! <threading>single in $(properties)
{
if ! [ configure.builds ../config//has_cxx20_atomic_ref : $(properties) : "has std::atomic_ref" ]
{
result = <define>BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF ;
result += <library>/boost/atomic//boost_atomic ;
}
}
else
{
result = <define>BOOST_FILESYSTEM_SINGLE_THREADED ;
}
#ECHO Result: $(result) ;
return $(result) ;
}
project boost/filesystem
: requirements
<host-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901
[ check-target-builds ../config//has_attribute_init_priority "has init_priority attribute" : <define>BOOST_FILESYSTEM_HAS_INIT_PRIORITY ]
[ check-target-builds ../config//has_stat_st_mtim "has stat::st_blksize" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE ]
[ check-target-builds ../config//has_stat_st_mtim "has stat::st_mtim" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_MTIM ]
[ check-target-builds ../config//has_stat_st_mtimensec "has stat::st_mtimensec" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC ]
[ check-target-builds ../config//has_stat_st_mtimespec "has stat::st_mtimespec" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC ]
[ check-target-builds ../config//has_stat_st_birthtim "has stat::st_birthtim" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIM ]
[ check-target-builds ../config//has_stat_st_birthtimensec "has stat::st_birthtimensec" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMENSEC ]
[ check-target-builds ../config//has_stat_st_birthtimespec "has stat::st_birthtimespec" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMESPEC ]
[ check-target-builds ../config//has_fdopendir_nofollow "has fdopendir(O_NOFOLLOW)" : <define>BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW ]
<conditional>@check-statx
<conditional>@select-windows-crypto-api
<conditional>@check-cxx20-atomic-ref
<target-os>windows:<define>_SCL_SECURE_NO_WARNINGS
<target-os>windows:<define>_SCL_SECURE_NO_DEPRECATE
<target-os>windows:<define>_CRT_SECURE_NO_WARNINGS
<target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE
<target-os>windows:<define>BOOST_USE_WINDOWS_H
<target-os>windows:<define>WIN32_LEAN_AND_MEAN
<target-os>windows:<define>NOMINMAX
<target-os>cygwin:<define>BOOST_USE_WINDOWS_H
<target-os>cygwin:<define>WIN32_LEAN_AND_MEAN
<target-os>cygwin:<define>NOMINMAX
: source-location ../src
: usage-requirements # pass these requirement to dependents (i.e. users)
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
<link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
;
SOURCES =
codecvt_error_category
exception
directory
operations
path
path_traits
portability
unique_path
utf8_codecvt_facet
;
rule select-platform-specific-sources ( properties * )
{
local result ;
if <target-os>windows in $(properties) || <target-os>cygwin in $(properties)
{
result += <source>windows_file_codecvt.cpp ;
}
return $(result) ;
}
lib boost_filesystem
: $(SOURCES).cpp
: <define>BOOST_FILESYSTEM_SOURCE
<conditional>@select-platform-specific-sources
<include>../src
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
<link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
:
:
;
boost-install boost_filesystem ;

View File

@@ -0,0 +1,37 @@
# Copyright 2022 Andrey Semashev
#
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#
# After including this module, BOOST_LIBRARY_INCLUDES variable is set to the list of include
# directories for all Boost libraries. If the monolithic include directory is found, it is
# used instead.
if (NOT CMAKE_VERSION VERSION_LESS 3.10)
include_guard()
endif()
# Generates a list of include paths for all Boost libraries in \a result variable. Uses unified Boost include tree, if available.
function(generate_boost_include_paths result)
if (IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../../../boost" AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../../boost/version.hpp")
get_filename_component(include_dir "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
set(${result} "${include_dir}" PARENT_SCOPE)
return()
endif()
file(GLOB path_list LIST_DIRECTORIES True "${CMAKE_CURRENT_LIST_DIR}/../../../libs/*")
foreach(path IN LISTS path_list)
if (IS_DIRECTORY "${path}/include")
get_filename_component(include_dir "${path}/include" ABSOLUTE)
list(APPEND include_list "${include_dir}")
endif()
endforeach()
set(${result} ${include_list} PARENT_SCOPE)
endfunction()
if (NOT DEFINED BOOST_LIBRARY_INCLUDES)
generate_boost_include_paths(__BOOST_LIBRARY_INCLUDES)
# Save the paths in a global property to avoid scanning the filesystem if this module is used in multiple libraries
set(BOOST_LIBRARY_INCLUDES ${__BOOST_LIBRARY_INCLUDES} CACHE INTERNAL "List of all Boost library include paths")
unset(__BOOST_LIBRARY_INCLUDES)
# message(STATUS "Boost library includes: ${BOOST_LIBRARY_INCLUDES}")
endif()

View File

@@ -0,0 +1,39 @@
#
# Copyright Andrey Semashev 2020 - 2021.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
obj has_attribute_init_priority : has_attribute_init_priority.cpp : <include>../src ;
explicit has_attribute_init_priority ;
obj has_cxx20_atomic_ref : has_cxx20_atomic_ref.cpp : <include>../src ;
explicit has_cxx20_atomic_ref ;
obj has_stat_st_blksize : has_stat_st_blksize.cpp : <include>../src ;
explicit has_stat_st_blksize ;
obj has_stat_st_mtim : has_stat_st_mtim.cpp : <include>../src ;
explicit has_stat_st_mtim ;
obj has_stat_st_mtimensec : has_stat_st_mtimensec.cpp : <include>../src ;
explicit has_stat_st_mtimensec ;
obj has_stat_st_mtimespec : has_stat_st_mtimespec.cpp : <include>../src ;
explicit has_stat_st_mtimespec ;
obj has_statx : has_statx.cpp : <include>../src ;
explicit has_statx ;
obj has_statx_syscall : has_statx_syscall.cpp : <include>../src ;
explicit has_statx_syscall ;
obj has_stat_st_birthtim : has_stat_st_birthtim.cpp : <include>../src ;
explicit has_stat_st_birthtim ;
obj has_stat_st_birthtimensec : has_stat_st_birthtimensec.cpp : <include>../src ;
explicit has_stat_st_birthtimensec ;
obj has_stat_st_birthtimespec : has_stat_st_birthtimespec.cpp : <include>../src ;
explicit has_stat_st_birthtimespec ;
obj has_fdopendir_nofollow : has_fdopendir_nofollow.cpp : <include>../src ;
explicit has_fdopendir_nofollow ;
lib bcrypt ;
explicit bcrypt ;
exe has_bcrypt : has_bcrypt.cpp : <include>../src <library>bcrypt ;
explicit has_bcrypt ;
obj is_windows_ce : is_windows_ce.cpp ;
explicit is_windows_ce ;

View File

@@ -0,0 +1,20 @@
// Copyright 2021 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
struct global_class
{
global_class() {}
~global_class() {}
};
__attribute__ ((init_priority(32767)))
global_class g_object;
int main()
{
return 0;
}

View File

@@ -0,0 +1,34 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
// Include platform_config.hpp first so that windows.h is guaranteed to be not included
#include "platform_config.hpp"
#include <boost/predef/os/windows.h>
#include <boost/predef/os/cygwin.h>
#if !BOOST_OS_WINDOWS && !BOOST_OS_CYGWIN
#error "This config test is for Windows only"
#endif
#include <boost/winapi/config.hpp>
#include <boost/predef/platform.h>
#if !(BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 && BOOST_WINAPI_PARTITION_APP_SYSTEM)
#error "No BCrypt API"
#endif
#include <cstddef>
#include <boost/winapi/basic_types.hpp>
#include <boost/winapi/bcrypt.hpp>
int main()
{
unsigned char buf[16] = {};
boost::winapi::BCRYPT_ALG_HANDLE_ handle;
boost::winapi::NTSTATUS_ status = boost::winapi::BCryptOpenAlgorithmProvider(&handle, boost::winapi::BCRYPT_RNG_ALGORITHM_, NULL, 0);
status = boost::winapi::BCryptGenRandom(handle, reinterpret_cast< boost::winapi::PUCHAR_ >(static_cast< unsigned char* >(buf)), static_cast< boost::winapi::ULONG_ >(sizeof(buf)), 0);
boost::winapi::BCryptCloseAlgorithmProvider(handle, 0);
}

View File

@@ -0,0 +1,19 @@
// Copyright 2021 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include <atomic>
typedef void func_t();
int main()
{
func_t* func = 0;
std::atomic_ref< func_t* > ref(func);
ref.load(std::memory_order_relaxed);
ref.store((func_t*)0, std::memory_order_relaxed);
return 0;
}

View File

@@ -0,0 +1,20 @@
// Copyright 2022 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
int main()
{
int fd = open(".", O_DIRECTORY | O_RDONLY | O_NOFOLLOW);
DIR* dir = fdopendir(fd);
return dir != 0;
}

View File

@@ -0,0 +1,19 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_birthtim.tv_sec = 1;
st.st_birthtim.tv_nsec = 10;
}

View File

@@ -0,0 +1,19 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_birthtime = 1;
st.st_birthtimensec = 10;
}

View File

@@ -0,0 +1,19 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_birthtimespec.tv_sec = 1;
st.st_birthtimespec.tv_nsec = 10;
}

View File

@@ -0,0 +1,18 @@
// Copyright 2021 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_blksize = 10;
}

View File

@@ -0,0 +1,18 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_mtim.tv_nsec = 10;
}

View File

@@ -0,0 +1,18 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_mtimensec = 10;
}

View File

@@ -0,0 +1,18 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
struct stat st;
st.st_mtimespec.tv_nsec = 10;
}

View File

@@ -0,0 +1,21 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
int main()
{
struct statx st;
int res = statx(AT_FDCWD, ".", AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT, STATX_BTIME, &st);
st.stx_btime.tv_sec = 1;
st.stx_btime.tv_nsec = 10;
}

View File

@@ -0,0 +1,35 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#include "platform_config.hpp"
#include <sys/syscall.h>
#include <linux/stat.h>
// Note: Include other libc headers for stat() as well to ensure there is no conflict between
// Linux kernel headers and libc headers.
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#if defined(__ANDROID__) && (__ANDROID_API__ < 30)
// Even though statx syscall number is defined, it is blacklisted by seccomp in runtime until Android 11
#error "statx syscall is not supported until Android 11"
#endif
#if !defined(__NR_statx)
#error "No statx syscall"
#endif
int main()
{
struct statx st;
int res = syscall(__NR_statx, AT_FDCWD, ".", AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT, STATX_BTIME, &st);
st.stx_btime.tv_sec = 1;
st.stx_btime.tv_nsec = 10;
}

View File

@@ -0,0 +1,14 @@
// Copyright 2020 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
#if !defined(_WIN32_WCE)
#error "This is not Windows CE"
#endif
int main()
{
}

View File

@@ -0,0 +1,23 @@
# Boost Filesystem Library Example Jamfile
# Copyright Beman Dawes 2010
# Distributed under the Boost Software License, Version 1.0.
# See www.boost.org/LICENSE_1_0.txt
# Library home page: http://www.boost.org/libs/filesystem
project
: requirements
<library>/boost/filesystem//boost_filesystem
<link>static
;
exe path_table : path_table.cpp ;
install path_table-copy : path_table : <location>. ;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;

View File

@@ -0,0 +1,55 @@
http://www.linuxfromscratch.org/blfs/view/svn/introduction/locale-issues.html
"The POSIX standard mandates that the filename encoding is the encoding implied by the current LC_CTYPE locale category."
-------
http://mail.nl.linux.org/linux-utf8/2001-02/msg00103.html
From: Markus Kuhn
Tom Tromey wrote on 2001-02-05 00:36 UTC:
> Kai> IMAO, a *real* filesystem should use some encoding of ISO 10646 -
> Kai> UTF-8, UTF-16, or UTF-32 are all viable options. The same should
> Kai> be true for the kernel filename interfaces.
>
> I like this, but what should I do right now?
The POSIX kernel file system interface is engraved into stone and
extremely unlikely to change. File names are arbitrary binary strings,
with only the '/' and '\0' bytes having any special semantics. You can
use arbitrary coded character sets on it as long as they do not
introduce '/' and '\0' bytes spuriously. Writers and readers have to
somehow agree on what encoding to use and the only really practical way
is to use the same encoding on all systems that share files. Eventually,
everyone will be using UTF-8 for file names on POSIX systems. Right now,
I would recommend users to use only ASCII for filenames, as this is
already UTF-8 and therefore simplifies migration. Using the ISO 8859,
JIS, etc. filenames should soon be considered deprecated practice.
> I work on libgcj, the runtime component of gcj, the Java front end to
> GCC. In libgcj of course we use UCS-2 everywhere, since that is what
> Java does. Currently, for Unixy systems, we assume that all file
> names are UTF-8.
The best solution is to assume that the file names are in the
locale-specific multi-byte encoding. Simply use mbrtowc and wcrtomb to
convert between Unicode and the locale-dependent multi-byte encoding
used in file names and text files if the ISO C 99 symbol
__STDC_ISO_10646__ is defined (which guarantees that wchar_t = UCS). On
Linux, this has been the case since glibc 2.2.
> (Actually, we do something notably worse, which is
> assume that file names are Java-style UTF-8, with the weird encoding
> for \u0000.)
\u0000 = NUL was never a character allowed in filenames under POSIX.
Raise an exception if someone tries to use it in a filename. Problem
solved.
I never understood, why Java found it necessary to introduce two
distinct ASCII NUL characters.
------
Interesting idea. Use iconv to create shift-jis or other mbcs test cases.

View File

@@ -0,0 +1,467 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem Deprecated Features</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem Deprecated Features</font>
</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<h2><a name="Deprecated-names">Deprecated names</a> and features</h2>
<p style="font-size: 10pt">As the library evolves over time, names sometimes
change or old features are removed to make way for new features. To ease transition, Boost.Filesystem deprecates
the old names and features, but by default continues to provide many of them.
The deprecated names and other workarounds can be suppressed by defining macro <code>
BOOST_FILESYSTEM_NO_DEPRECATED</code>, and this is recommended for all new code.</p>
<p style="font-size: 10pt">In the table, &#10004; indicates a synonym or other
workaround is provided unless <code>
BOOST_FILESYSTEM_NO_DEPRECATED</code> is defined.</p>
<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td style="font-size: 10pt" valign="top">
<b><i>Component or location</i></b></td>
<td style="font-size: 10pt" valign="top">
<p style="font-size: 10pt"><b><i>Old name, now deprecated</i></b></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<p style="font-size: 10pt"><b><i>New name</i></b></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>branch_path()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>parent_path()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>canonize()</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>default_name_check()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>default_name_check(name_check)</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>default_name_check_writable()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>directory_string()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>string</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>external_directory_string()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>native()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>external_file_string()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>native()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>file_string()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>string()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>has_branch_path()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>has_parent_path()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>has_leaf()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>has_filename()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>is_complete()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>is_absolute()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class path</code></td>
<td style="font-size: 10pt" valign="top"><code>leaf()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>filename()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>native_directory_string()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<code>string()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>native_file_string()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<code>string()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>normalize()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>path(const string_type&amp; str, name_check)</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed. Workaround ignores </i><code>name_check</code><i>
argument.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<code>path(const string_type::value_type* s,&nbsp; name_check)</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed. Workaround ignores </i><code>name_check</code><i>
argument.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
<td style="font-size: 10pt" valign="top">
<p style="font-size: 10pt"><code>remove_leaf()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<p style="font-size: 10pt"><code>remove_filename()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>path.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>template&lt;class String, class Traits&gt;<br>
&nbsp; class basic_path;</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
Class template <code>basic_path</code> is replaced by class <code>path</code>.
No workaround for an explicitly coded <code>basic_path</code> is provided,
but see the next row - <code>path</code>.</td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>path.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>typedef basic_path&lt;std::string, path_traits&gt; path</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<code>class path</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>path.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>typedef basic_path&lt;std::wstring, wpath_traits&gt; wpath</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Removed; use </i><code>class path</code><i> instead. Workaround provides
</i><code>typedef path wpath</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>operations.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>initial_path()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>operations.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<p dir="ltr"><code>template &lt;class Path&gt;<br>
Path complete(const Path&amp; p,<br>
&nbsp;const Path&amp; base=<br>
&nbsp;&nbsp; initial_path&lt;Path&gt;())</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<p dir="ltr"><code>path absolute(const path&amp; p, const path&amp; base=<br>
&nbsp; current_path())</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>operations.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>is_regular(file_status f)</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<p dir="ltr">
<code>is_regular_file(file_status f)</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>operations.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>symbolic_link_exists(const path&amp; ph)</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>operations.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>copy_directory(const path&amp; from, const path&amp; to)</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed, use <code>create_directory(const path&amp; to, const path&amp; from)</code> instead (note the reversed order of arguments)</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class directory_entry</code></td>
<td style="font-size: 10pt" valign="top">
<code>filename()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed, use </i><code>path().filename()</code><i> instead.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class directory_entry</code></td>
<td style="font-size: 10pt" valign="top">
<code>leaf()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed, use </i><code>path().filename()</code><i> instead.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>class directory_entry</code></td>
<td style="font-size: 10pt" valign="top">
<code>string()</code></td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Function removed, use </i><code>path().string()</code><i> instead.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class recursive_directory_iterator</code></td>
<td style="font-size: 10pt" valign="top"><code>level()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>depth()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class recursive_directory_iterator</code></td>
<td style="font-size: 10pt" valign="top"><code>no_push_pending()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>!recursion_pending()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>class recursive_directory_iterator</code></td>
<td style="font-size: 10pt" valign="top"><code>no_push()</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><code>disable_recursion_pending()</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top"><code>directory.hpp</code></td>
<td style="font-size: 10pt" valign="top"><code>enum class symlink_option</code></td>
<td style="font-size: 10pt" valign="top">&#10004;</td>
<td style="font-size: 10pt" valign="top"><i>Removed; use corresponding values of </i><code>enum class directory_options</code><i> instead.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>directory.hpp</code></td>
<td style="font-size: 10pt" valign="top">
<code>wrecursive_directory_iterator</code> typedef</td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>Removed; use </i><code>class recursive_directory_iterator</code><i> instead. Workaround provides
</i><code>typedef recursive_directory_iterator wrecursive_directory_iterator</code></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>operations.hpp</code></td>
<td style="font-size: 10pt" valign="top">
The header provides <code>filesystem_error</code>, <code>file_status</code>, <code>directory_entry</code>, <code>directory_iterator</code>, <code>recursive_directory_iterator</code> and associated enums and functions.</td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>These components were moved to separate headers </i><code>exception.hpp</code><i>, </i><code>file_status.hpp</code><i> and </i><code>directory.hpp</code><i>.
The workaround is to include the new headers or </i><code>filesystem.hpp</code><i>. The new headers are still included by </i><code>operations.hpp</code><i> if
</i><code>BOOST_FILESYSTEM_NO_DEPRECATED</code><i> is not defined.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
<code>string_file.hpp</code></td>
<td style="font-size: 10pt" valign="top">
The header provides utility functions for loading and saving a string to/from file.</td>
<td style="font-size: 10pt" valign="top">
&#10004;</td>
<td style="font-size: 10pt" valign="top">
<i>The header is deprecated, use a different implementation of these functions. Unavailable if </i><code>BOOST_FILESYSTEM_NO_DEPRECATED</code><i> is defined and will be permanently removed in a future release.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
Macro definitions</td>
<td style="font-size: 10pt" valign="top">
<code>BOOST_WINDOW_API</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>No longer supported; API selection is always automatic.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
Macro definitions</td>
<td style="font-size: 10pt" valign="top">
<code>BOOST_POSIX_API</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>No longer supported; API selection is always automatic.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
Macro definitions</td>
<td style="font-size: 10pt" valign="top">
<code>BOOST_WINDOW_PATH</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>No longer supported; native path format selection is always automatic.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
Macro definitions</td>
<td style="font-size: 10pt" valign="top">
<code>BOOST_POSIX_PATH</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>No longer supported; native path format selection is always automatic.</i></td>
</tr>
<tr>
<td style="font-size: 10pt" valign="top">
Build system</td>
<td style="font-size: 10pt" valign="top">
<code>Auto-linking on Windows</code></td>
<td style="font-size: 10pt" valign="top">
&nbsp;</td>
<td style="font-size: 10pt" valign="top">
<i>No longer supported. When users are linking against static library of Boost.Filesystem,
they are recommended to explicitly add Boost.Filesystem dependencies to their linker command
line. Shared library of Boost.Filesystem is not affected by this as it is already linked with
all its dependencies.</i></td>
</tr>
</table>
<h2>Deprecation rationale</h2>
<h3><code>initial_path</code> function</h3>
<p dir="ltr">Full implementation of <code>initial_path()</code> would require
support from the C++ runtime startup code, and that doesn't seem likely to
happen. Depending on the user to call <code>initial_path()</code> at the
beginning of <code>main()</code> is too error prone.&nbsp; An equivalent
function can trivially be provided by a user.</p>
<hr>
<p>&copy; Copyright Beman Dawes, 2002-2005, 2010</p>
<p>&copy; Copyright Andrey Semashev, 2019-2021</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,351 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Boost Filesystem Library Design</title>
<link href="styles.css" rel="stylesheet">
</head>
<body bgcolor="#FFFFFF">
<h1>
<img border="0" src="../../../boost.png" align="center" width="277" height="86">Filesystem
Library Design</h1>
<p><a href="#Introduction">Introduction</a><br>
<a href="#Requirements">Requirements</a><br>
<a href="#Realities">Realities</a><br>
<a href="#Rationale">Rationale</a><br>
<a href="#Abandoned_Designs">Abandoned_Designs</a><br>
<a href="#References">References</a></p>
<h2><a name="Introduction">Introduction</a></h2>
<p>The primary motivation for beginning work on the Filesystem Library was
frustration with Boost administrative tools.&nbsp; Scripts were written in
Python, Perl, Bash, and Windows command languages.&nbsp; There was no single
scripting language familiar and acceptable to all Boost administrators. Yet they
were all skilled C++ programmers - why couldn't C++ be used as the scripting
language?</p>
<p>The key feature C++ lacked for script-like applications was the ability to
perform portable filesystem operations on directories and their contents. The
Filesystem Library was developed to fill that void.</p>
<p>The intent is not to compete with traditional scripting languages, but to
provide a solution for situations where C++ is already the language
of choice..</p>
<h2><a name="Requirements">Requirements</a></h2>
<ul>
<li>Be able to write portable script-style filesystem operations in modern
C++.<br>
<br>
Rationale: This is a common programming need. It is both an
embarrassment and a hardship that this is not possible with either the current
C++ or Boost libraries.&nbsp; The need is particularly acute
when C++ is the only toolset allowed in the tool chain.&nbsp; File system
operations are provided by many languages&nbsp;used on multiple platforms,
such as Perl and Python, as well as by many platform specific scripting
languages. All operating systems provide some form of API for filesystem
operations, and the POSIX bindings are increasingly available even on
operating systems not normally associated with POSIX, such as the Mac, z/OS,
or OS/390.<br>
&nbsp;</li>
<li>Work within the <a href="#Realities">realities</a> described below.<br>
<br>
Rationale: This isn't a research project. The need is for something that works on
today's platforms, including some of the embedded operating systems
with limited file systems. Because of the emphasis on portability, such a
library would be much more useful if standardized. That means being able to
work with a much wider range of platforms that just Unix or Windows and their
clones.<br>
&nbsp;</li>
<li>Avoid dangerous programming practices. Particularly, all-too-easy-to-ignore error notifications
and use of global variables.&nbsp;If a dangerous feature is provided, identify it as such.<br>
<br>
Rationale: Normally this would be covered by &quot;the usual Boost requirements...&quot;,
but it is mentioned explicitly because the equivalent native platform and
scripting language interfaces often depend on all-too-easy-to-ignore error
notifications and global variables like &quot;current
working directory&quot;.<br>
&nbsp;</li>
<li>Structure the library so that it is still useful even if some functionality
does not map well onto a given platform or directory tree. Particularly, much
useful functionality should be portable even to flat
(non-hierarchical) filesystems.<br>
<br>
Rationale: Much functionality which does not
require a hierarchical directory structure is still useful on flat-structure
filesystems.&nbsp; There are many systems, particularly embedded systems,
where even very limited functionality is still useful.</li>
</ul>
<ul>
<li>Interface smoothly with current C++ Standard Library input/output
facilities.&nbsp; For example, paths should be
easy to use in std::basic_fstream constructors.<br>
<br>
Rationale: One of the most common uses of file system functionality is to
manipulate paths for eventual use in input/output operations.&nbsp;
Thus the need to interface smoothly with standard library I/O.<br>
&nbsp;</li>
<li>Suitable for eventual standardization. The implication of this requirement
is that the interface be close to minimal, and that great care be take
regarding portability.<br>
<br>
Rationale: The lack of file system operations is a serious hole
in the current standard, with no other known candidates to fill that hole.
Libraries with elaborate interfaces and difficult to port specifications are much less likely to be accepted for
standardization.<br>
&nbsp;</li>
<li>The usual Boost <a href="http://www.boost.org/more/lib_guide.htm">requirements and
guidelines</a> apply.<br>
&nbsp;</li>
<li>Encourage, but do not require, portability in path names.<br>
<br>
Rationale: For paths which originate from user input it is unreasonable to
require portable path syntax.<br>
&nbsp;</li>
<li>Avoid giving the illusion of portability where portability in fact does not
exist.<br>
<br>
Rationale: Leaving important behavior unspecified or &quot;implementation defined&quot; does a
great disservice to programmers using a library because it makes it appear
that code relying on the behavior is portable, when in fact there is nothing
portable about it. The only case where such under-specification is acceptable is when both users and implementors know from
other sources exactly what behavior is required, yet for some reason it isn't
possible to specify it exactly.</li>
</ul>
<h2><a name="Realities">Realities</a></h2>
<ul>
<li>Some operating systems have a single directory tree root, others have
multiple roots.<br>
&nbsp;</li>
<li>Some file systems provide both a long and short form of filenames.<br>
&nbsp;</li>
<li>Some file systems have different syntax for file paths and directory
paths.<br>
&nbsp;</li>
<li>Some file systems have different rules for valid file names and valid
directory names.<br>
&nbsp;</li>
<li>Some file systems (ISO-9660, level 1, for example) use very restricted
(so-called 8.3) file names.<br>
&nbsp;</li>
<li>Some operating systems allow file systems with different
characteristics to be &quot;mounted&quot; within a directory tree.&nbsp; Thus an
ISO-9660 or Windows
file system may end up as a sub-tree of a POSIX directory tree.<br>
&nbsp;</li>
<li>Wide-character versions of directory and file operations are available on some operating
systems, and not available on others.<br>
&nbsp;</li>
<li>There is no law that says directory hierarchies have to be specified in
terms of left-to-right decent from the root.<br>
&nbsp;</li>
<li>Some file systems have a concept of file &quot;version number&quot; or &quot;generation
number&quot;.&nbsp; Some don't.<br>
&nbsp;</li>
<li>Not all operating systems use single character separators in path names.&nbsp; Some use
paired notations. A typical fully-specified OpenVMS filename
might look something like this:<br>
<br>
<code>&nbsp;&nbsp; DISK$SCRATCH:[GEORGE.PROJECT1.DAT]BIG_DATA_FILE.NTP;5<br>
</code><br>
The general OpenVMS format is:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>Device:[directories.dot.separated]filename.extension;version_number</i><br>
&nbsp;</li>
<li>For common file systems, determining if two descriptors are for same
entity is extremely difficult or impossible.&nbsp; For example, the concept of
equality can be different for each portion of a path - some portions may be
case or locale sensitive, others not. Case sensitivity is a property of the
pathname itself, and not the platform. Determining collating sequence is even
worse.<br>
&nbsp;</li>
<li>Race-conditions may occur. Directory trees, directories, files, and file attributes are in effect shared between all threads, processes, and computers which have access to the
filesystem.&nbsp; That may well include computers on the other side of the
world or in orbit around the world. This implies that file system operations
may fail in unexpected ways.&nbsp;For example:<br>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp; assert( exists(&quot;foo&quot;) == exists(&quot;foo&quot;) );
// may fail!<br>
&nbsp;&nbsp;&nbsp;&nbsp; assert( is_directory(&quot;foo&quot;) == is_directory(&quot;foo&quot;);
// may fail!<br>
</code><br>
In the first example, the file may have been deleted between calls to
exists().&nbsp; In the second example, the file may have been deleted and then
replaced by a directory of the same name between the calls to is_directory().<br>
&nbsp;</li>
<li>Even though an application may be portable, it still will have to traffic
in system specific paths occasionally; user provided input is a common
example.<br>
&nbsp;</li>
<li><a name="symbolic-link-use-case">Symbolic</a> links cause canonical and
normal form of some paths to represent different files or directories. For
example, given the directory hierarchy <code>/a/b/c</code>, with a symbolic
link in <code>/a</code> named <code>x</code>&nbsp; pointing to <code>b/c</code>,
then under POSIX Pathname Resolution rules a path of <code>&quot;/a/x/..&quot;</code>
should resolve to <code>&quot;/a/b&quot;</code>. If <code>&quot;/a/x/..&quot;</code> were first
normalized to <code>&quot;/a&quot;</code>, it would resolve incorrectly. (Case supplied
by Walter Landry.)</li>
</ul>
<h2><a name="Rationale">Rationale</a></h2>
<p>The <a href="#Requirements">Requirements</a> and <a href="#Realities">
Realities</a> above drove much of the C++ interface design.&nbsp; In particular,
the desire to make script-like code straightforward caused a great deal of
effort to go into ensuring that apparently simple expressions like <i>exists( &quot;foo&quot;
)</i> work as expected.</p>
<p>See the <a href="faq.htm">FAQ</a> for the rationale behind many detailed
design decisions.</p>
<p>Several key insights went into the <i>path</i> class design:</p>
<ul>
<li>Decoupling of the input formats, internal conceptual (<i>vector&lt;string&gt;</i>
or other sequence)
model, and output formats.</li>
<li>Providing two input formats (generic and O/S specific) broke a major
design deadlock.</li>
<li>Providing several output formats solved another set of previously
intractable problems.</li>
<li>Several non-obvious functions (particularly decomposition and composition)
are required to support portable code. (Peter Dimov, Thomas Witt, Glen
Knowles, others.)</li>
</ul>
<p>Error checking was a particularly difficult area. One key insight was that
with file and directory names, portability isn't a universal truth.&nbsp;
Rather, the programmer must think out the question &quot;What operating systems do I
want this path to be portable to?&quot;&nbsp; By providing support for several
answers to that question, the Filesystem Library alerts programmers of the need
to ask it in the first place.</p>
<h2><a name="Abandoned_Designs">Abandoned Designs</a></h2>
<h3>operations.hpp</h3>
<p>Dietmar Kühl's original <code>directory_iterator</code> design and implementation supported
wide-character file and directory names. It was abandoned after extensive
discussions among Library Working Group members failed to identify portable
semantics for wide-character names on systems not providing native support. See
<a href="faq.htm#wide-character_names">FAQ</a>.</p>
<p>Previous iterations of the interface design used explicitly named functions providing a
large number of convenience operations, with no compile-time or run-time
options. There were so many function names that they were very confusing to use,
and the interface was much larger. Any benefits seemed theoretical rather than
real. </p>
<p>Designs based on compile time (rather than runtime) flag and option selection
(via policy, enum, or int template parameters) became so complicated that they
were abandoned, often after investing quite a bit of time and effort. The need
to qualify attribute or option names with namespaces, even aliases, made use in
template parameters ugly; that wasn't fully appreciated until actually writing
real code.</p>
<p>Yet another set of convenience functions ( for example, <i>remove</i> with
permissive, prune, recurse, and other options, plus predicate, and possibly
other, filtering features) were abandoned because the details became both
complex and contentious.</p>
<p>What is left is a toolkit of low-level operations from which the user can
create more complex convenience operations, plus a very small number of
convenience functions which were found to be useful enough to justify inclusion.</p>
<h3>path.hpp</h3>
<p>There were so many abandoned path designs, I've lost track. Policy-based
class templates in several flavors, constructor supplied runtime policies,
operation specific runtime policies, they were all considered, often
implemented, and ultimately abandoned as far too complicated for any small
benefits observed.</p>
<p>Additional design considerations apply to <a href="v3_design.html">Internationalization</a>. </p>
<h3>error checking</h3>
<p>A number of designs for the error checking machinery were abandoned, some
after experiments with implementations. Totally automatic error checking was
attempted in particular. But automatic error checking tended to make the overall
library design much more complicated.</p>
<p>Some designs associated error checking mechanisms with paths.&nbsp; Some with
operations functions.&nbsp; A policy-based error checking template design was
partially implemented, then abandoned as too complicated for everyday
script-like programs.</p>
<p>The final design, which depends partially on explicit error checking function
calls,&nbsp; is much simpler and straightforward, although it does depend to
some extent on programmer discipline.&nbsp; But it should allow programmers who
are concerned about portability to be reasonably sure that their programs will
work correctly on their choice of target systems.</p>
<h2><a name="References">References</a></h2>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="13%" valign="top">[<a name="IBM-01">IBM-01</a>]</td>
<td width="87%">IBM Corporation, <i>z/OS V1R3.0 C/C++ Run-Time
Library Reference</i>, SA22-7821-02, 2001,
<a href="http://www-1.ibm.com/servers/eserver/zseries/zos/bkserv/">
www-1.ibm.com/servers/eserver/zseries/zos/bkserv/</a></td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="ISO-9660">ISO-9660</a>]</td>
<td width="87%">International Standards Organization, 1988</td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="Kuhn">Kuhn</a>]</td>
<td width="87%">UTF-8 and Unicode FAQ for Unix/Linux,
<a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html">
www.cl.cam.ac.uk/~mgk25/unicode.html</a></td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="MSDN">MSDN</a>] </td>
<td width="87%">Microsoft Platform SDK for Windows, Storage Start
Page,
<a href="http://msdn.microsoft.com/library/en-us/fileio/base/storage_start_page.asp">
msdn.microsoft.com/library/en-us/fileio/base/storage_start_page.asp</a></td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="POSIX-01">POSIX-01</a>]</td>
<td width="87%">IEEE&nbsp;Std&nbsp;1003.1-2001, ISO/IEC 9945:2002, and The Open Group Base Specifications, Issue 6. Also known as The
Single UNIX&reg; Specification, Version 3.
Available from each of the organizations involved in its creation. For
example, read online or download from
<a href="http://www.unix.org/single_unix_specification/">
www.unix.org/single_unix_specification/</a>.</font> The ISO JTC1/SC22/WG15 - POSIX
homepage is <a href="http://www.open-std.org/jtc1/sc22/WG15/">
www.open-std.org/jtc1/sc22/WG15/</a></td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="URI">URI</a>]</td>
<td width="87%">RFC-2396, Uniform Resource Identifiers (URI): Generic
Syntax, <a href="http://www.ietf.org/rfc/rfc2396.txt">
www.ietf.org/rfc/rfc2396.txt</a></td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="UTF-16">UTF-16</a>]</td>
<td width="87%">Wikipedia, UTF-16,
<a href="http://en.wikipedia.org/wiki/UTF-16">
en.wikipedia.org/wiki/UTF-16</a></td>
</tr>
<tr>
<td width="13%" valign="top">[<a name="Wulf-Shaw-73">Wulf-Shaw-73</a>]</td>
<td width="87%">William Wulf, Mary Shaw, <i>Global
Variable Considered Harmful</i>, ACM SIGPLAN Notices, 8, 2, 1973, pp. 23-34</td>
</tr>
</table>
<hr>
<p>&copy; Copyright Beman Dawes, 2002</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
</html>

View File

@@ -0,0 +1,146 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Do List</title>
<style type="text/css">
body { font-family: sans-serif; margin: 1em; }
p, td, li, blockquote { font-size: 10pt; }
pre { font-size: 9pt; }
</style>
</head>
<body>
<h1>Boost Filesystem Do List<br>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->24 June 2010<!--webbot bot="Timestamp" endspan i-checksum="17552" --></h1>
<h2>Beta 1 comments</h2>
<ul>
<li dir="ltr">
<p dir="ltr">Zach Laine:</li>
</ul>
<blockquote>
<pre dir="ltr">The descriptions for portable_name() and portable_directory_name()
appear to be at odds.
portable_name() : ... &amp;&amp; (name is &quot;.&quot; or &quot;..&quot;, and the first character
not a period or hyphen)
portable_directory_name(): ... &amp;&amp; (name is &quot;.&quot; or &quot;..&quot; &nbsp;or contains no periods)
Should portable_name() be &quot;... &amp;&amp; (name is &quot;.&quot; or &quot;..&quot;, or contains no
periods) &amp;&amp; (first character not a hyphen)&quot;? &nbsp;Maybe I'm missing
something?</pre>
</blockquote>
<ul>
<li dir="ltr">
<p dir="ltr">Scott McMurray - treat as Wish List:</li>
</ul>
<blockquote>
<pre dir="ltr">- uncomplete(p, base)
My pet request. &nbsp;It may be useful to simplify other functions as well,
since there's no current way to go from an absolute path to a relative
one, meaning that most functions need to handle relative ones even
when that might not be natural. &nbsp;With this functionality,
preconditions requiring absolute paths would be less onerous.
&nbsp; &nbsp;Precondition: p.is_absolute() &amp;&amp; base.is_absolute()
&nbsp; &nbsp;Effects: Extracts a path, rp, from p relative to base such that
canonical(p) == complete(rp, base). &nbsp;Any &quot;..&quot; path elements in rp form
a prefix.
&nbsp; &nbsp;Returns: The extracted path.
&nbsp; &nbsp;Postconditions: For the returned path, rp, rp.is_relative() ==
(p.root_name() == b.root_name()).
[Notes: This function simplifies paths by omitting context. &nbsp;It is
particularly useful for serializing paths such that it can be usefully
moved between hosts where the context may be different, such as inside
source control trees. &nbsp;It can also be helpful for display to users,
such as in shells where paths are often shown relative to $HOME.
In the presence of symlinks, the result of this function may differ
between implementations, as some may expand symlinks that others may
not. &nbsp;The simplest implementation uses canonical to expand both p and
base, then removes the common prefix and prepends the requisite &quot;..&quot;
elements. &nbsp;Smarter implementations will avoid expanding symlinks
unnecessarily. &nbsp;No implementation is expected to discover new symlinks
to return paths with fewer elements.]</pre>
</blockquote>
<h2 dir="ltr">Docs</h2>
<ul>
<li>Reorganize files - delete examples that no longer apply.</li>
<li>Should minimal.css be changed to used relative font sizes? See
<a href="http://www.w3schools.com/CSS/pr_font_font-size.asp/">http://www.w3schools.com/CSS/pr_font_font-size.asp\</a></li>
<li>Document behavior of path::replace_extension has change WRT argument w/o a
dot.</li>
<li style="font-size: 10pt">Document leading //: no longer treated specially.
But is that really correct?</li>
<li style="font-size: 10pt">Behavior of root_path() has been changed. Change
needs to be propagated to trunk?</li>
<li style="font-size: 10pt">Regenerate path decomposition table.</li>
</ul>
<h2>Code</h2>
<h3>All</h3>
<ul>
<li style="font-size: 10pt">Move semantics.</li>
<li style="font-size: 10pt">Use BOOST_DELETED, BOOST_DEFAULTED, where
appropriate.</li>
<li style="font-size: 10pt">Other C++0x features.</li>
</ul>
<h3>Class path</h3>
<ul>
<li>Windows, POSIX, conversions for char16_t, char32_t for C++0x compilers.</li>
<li>Add Windows Alternate Data Stream test cases. See http://en.wikipedia.org/wiki/NTFS
Features.</li>
<li>Add test case: relational operators on paths differing only in trailing
separator. Rationale?</li>
<li>Provide the name check functions for more character types? Templatize?
take a path argument?</li>
<li style="font-size: 10pt">Add codepage 936/950/etc test cases.</li>
<li style="font-size: 10pt">Should UDT's be supported?</li>
<li style="font-size: 10pt">Should path iteration to a separator result in:<br>
-- the actual separator used<br>
-- the preferred separator<br>
-- the generic separator &lt;-- makes it easier to write portable code<br>
-- a dot</li>
</ul>
<h3>Operations</h3>
<ul>
<li>Would complete(), system_complete() be clearer if renamed absolute(),
absolute_system() (or absolute_native())?</li>
<li>Review all operations.cpp code for race conditions similar to #2925. Fix
or document.</li>
<li>Enable all BOOST_FILESYSTEM_NO_DEPRECATED code.</li>
<li>rename and remove names are problems. If users says &quot;using
namespace boost::filesystem&quot;<br>
and some header included stdio, there is just too much chance of silent error.</li>
<li>create_directories error handling needs work.</li>
<li>Fold convenience.hpp into operations.hpp</li>
<li>Two argument recursive_directory_iterator ctor isn't recognizing throws().
Would it be better to fold into a single two argument ctor with default?</li>
<li>Add the push_directory class from tools/release/required_files.cpp</li>
</ul>
<h3>Miscellaneous</h3>
<ul>
<li style="font-size: 10pt"><i>Regular</i> classes need hash functions.</li>
</ul>
<hr>
<p>&copy; Copyright Beman Dawes, 2010</p>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,149 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem FAQ</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem FAQ</font>
</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<h1>
Frequently Asked Questions</h1>
<h2>General questions</h2>
<p><b>Why not support a concept of specific kinds of file systems, such as posix_file_system or windows_file_system.</b></p>
<p>Portability is one of the most important requirements for the
library.&nbsp;Features specific to a particular operating system or file system
can always be accessed by using the operating system's API.</p>
<h2>
Class <code><font size="6">path</font></code> questions </h2>
<p><b>Why base the generic pathname format on POSIX?</b></p>
<p><a href="design.htm#POSIX-01">POSIX</a> is an ISO Standard. It is the basis for the most familiar
pathname formats,
not just for POSIX-based operating systems but also for Windows and the
URL portion of URI's. It is ubiquitous and
familiar.&nbsp; On many systems, it is very easy to implement because it is
either the native operating system format (Unix and Windows) or via an
operating system supplied
POSIX library (z/OS, OS/390, and many more.)</p>
<p><b>Why not use a full URI (Universal Resource Identifier) based path?</b></p>
<p><a href="design.htm#URI">URI's</a> would promise more than the Filesystem Library can actually deliver,
since URI's extend far beyond what most operating systems consider a file or a
directory.&nbsp; Thus for the primary &quot;portable script-style file system
operations&quot; requirement of the Filesystem Library, full URI's appear to be over-specification.</p>
<p><b>Why isn't <i>path</i> a base class with derived <i>directory_path</i> and
<i>file_path</i> classes?</b></p>
<p>Why bother?&nbsp; The behavior of all three classes is essentially identical.
Several early versions did require users to identify each path as a file or
directory path, and this seemed to increase coding errors and decrease code
readability. There was no apparent upside benefit.</p>
<p><b>Why do path decomposition functions yielding a single element return a
path rather than a string?</b></p>
<p>Interface simplicity. If they returned strings, flavors would be needed for
<code>string</code>, <code>wstring</code>, <code>u16string</code>,
<code>u32string</code>, and generic strings.</p>
<p><b>Why don't path member functions have overloads with error_code&amp; arguments?</b></p>
<p>They have not been requested by users; the need for error reporting via
error_code seems limited to operations failures rather than path failures.</p>
<h2>Operations function questions</h2>
<p><b>Why not supply a 'handle' type, and let the file and directory operations
traffic in it?</b></p>
<p>It isn't clear there is any feasible way to meet the &quot;portable script-style
file system operations&quot; requirement with such a system. File systems exist where operations are usually performed on
some non-string handle type. The classic Mac OS has been mentioned explicitly as a case where
trafficking in paths isn't always natural.&nbsp;&nbsp;&nbsp; </p>
<p>The case for the &quot;handle&quot; (opaque data type to identify a file)
style may be strongest for directory iterator value type.&nbsp; (See Jesse Jones' Jan 28,
2002, Boost postings). However, as class path has evolved, it seems sufficient
even as the directory iterator value type.</p>
<p><b>Why are the operations functions so low-level?</b></p>
<p>To provide a toolkit from which higher-level functionality can be created.</p>
<p>An
extended attempt to add convenience functions on top of, or as a replacement
for, the low-level functionality failed because there is no widely acceptable
set of simple semantics for most convenience functions considered.&nbsp;
Attempts to provide alternate semantics via either run-time options or
compile-time polices became overly complicated in relation to the value
delivered, or became contentious.&nbsp; OTOH, the specific functionality needed for several trial
applications was very easy for the user to construct from the lower-level
toolkit functions.&nbsp; See <a href="design.htm#Abandoned_Designs">Failed
Attempts</a>.</p>
<p><b>Isn't it inconsistent then to provide a few convenience functions?</b></p>
<p>Yes, but experience with both this library, POSIX, and Windows, indicates
the utility of certain convenience functions, and that it is possible to provide
simple, yet widely acceptable, semantics for them. For example, <code>remove_all()</code>.</p>
<p><b>Why are there directory_iterator overloads for operations.hpp
predicate functions? Isn't two ways to do the same thing poor design?</b></p>
<p>Yes, two ways to do the same thing is often a poor design practice. But the
iterator versions are often much more efficient. Calling status() during
iteration over a directory containing 15,000 files took 6 seconds for the path
overload, and 1 second for the iterator overload, for tests on a freshly booted
machine. Times were .90 seconds and .30 seconds, for tests after prior use of
the directory. This performance gain is large enough to justify deviating from
preferred design practices. Neither overload alone meets all needs.</p>
<p><b>Why are the operations functions so picky about errors?</b></p>
<p>Safety. The default is to be safe rather than sorry. This is particularly
important given the reality that on many computer systems files and directories
are globally shared resources, and thus subject to
race conditions.</p>
<p><b>Why are attributes accessed via named functions rather than property maps?</b></p>
<p>For commonly used attributes (existence, directory or file, emptiness),
simple syntax and guaranteed presence outweigh other considerations. Because
access to many other attributes is inherently system dependent,
property maps are viewed as the best hope for access and modification, but it is
better design to provide such functionality in a separate library. (Historical
note: even the apparently simple attribute &quot;read-only&quot; turned out to be so
system depend as to be disqualified as a &quot;guaranteed presence&quot; operation.)</p>
<p><b>Why isn't automatic name portability error detection provided?</b></p>
<p>A number (at least six) of designs for name validity error
detection were evaluated, including at least four complete implementations.&nbsp;
While the details for rejection differed, all of the more powerful name validity checking
designs distorted other
otherwise simple aspects of the library. Even the simple name checking provided
in prior library versions was a constant source of user complaints. While name checking can be helpful, it
isn't important enough to justify added a lot of additional complexity.</p>
<p><b>Why are paths sometimes manipulated by member functions and sometimes by
non-member functions?</b></p>
<p>The design rule is that purely lexical operations are supplied as <i>class
path</i> member
functions, while operations performed by the operating system are provided as
free functions.</p>
<hr>
<p>&copy; Copyright Beman Dawes, 2002</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,498 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem Home</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle"
width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem Library<br>
Version 4</font>
</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports</a>&nbsp;&nbsp;
</td>
</table>
<p></p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" align="right">
<tr>
<td width="100%" bgcolor="#D7EEFF" align="center">
<i><b>Contents</b></i></td>
</tr>
<tr>
<td width="100%" bgcolor="#E8F5FF">
<a href="#Introduction">Introduction</a><br>
<a href="#Documentation">Documentation</a><br>
<a href="#Using">Using the library</a><br>
<a href="#Coding-guidelines">Coding guidelines</a><br>
<a href="#Cautions">Cautions</a><br>
<a href="#Headers">Headers</a><br>
<a href="#Examples">Example programs</a><br>
<a href="#Implementation">Implementation</a><br>
<a href="#Macros">Macros</a><br>
<a href="#Building">Building the object-library</a><br>
<a href="#Cgywin">Notes for Cygwin users</a><br>
<a href="#Change-history">Version history<br>
&nbsp; with acknowledgements</a></td>
</tr>
</table>
<p></p>
<h2><a name="Introduction">Introduction</a></h2>
<p>The Boost.Filesystem library provides facilities to manipulate files and directories,
and the paths that identify them.</p>
<p>The features of the library include:</p>
<ul>
<li><b>A modern C++ interface, highly compatible with the C++ standard
library.</b></li>
</ul>
<blockquote>
<blockquote>
<p>Many users say the interface is their primary motivation for using
Boost.Filesystem. They like its use of familiar idioms based on standard library
containers, iterators, and algorithms. They like having errors reported by
throwing exceptions.</p>
</blockquote>
</blockquote>
<ul>
<li><b>Portability between operating systems.</b><br>
&nbsp;<ul>
<li>At the C++ syntax level, it is convenient to learn and use one interface
regardless of the operating system.</li>
<li>At the semantic level, behavior of code is reasonably portable across
operating systems.</li>
<li>Dual generic or native path format support encourages program
portability, yet still allows communication with users in system specific
formats.<br>
&nbsp;</li>
</ul>
</li>
<li><b>Error handling and reporting via C++ exceptions (the default) or error
codes.</b><br>
&nbsp;<ul>
<li>C++ exceptions are the preferred error reporting mechanism for most
applications. The exception thrown includes the detailed error code
information important for diagnosing the exact cause of file system errors.</li>
<li>Error reporting via error code allows user code that provides detailed
error recovery to avoid becoming so littered with try-catch blocks as to be
unmaintainable. <br>
&nbsp;</li>
</ul>
</li>
<li><b>Suitable for a broad spectrum of applications, ranging from simple
script-like operations to extremely complex production code.</b><br>
&nbsp;<ul>
<li>At the simple script-like end of the spectrum, the intent is not to
compete with Python, Perl, or shell languages, but rather to provide
filesystem operations when C++ is already the language of choice.</li>
<li dir="ltr">
<p dir="ltr">Finer grained control over operations and error handling is available to
support more complex applications or other cases where throwing exceptions
isn't desired.<br>
&nbsp;</li>
</ul>
</li>
<li>
<p dir="ltr"><b>Forms the basis for
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf">
ISO/IEC TS 18822</a>, the C++ standard library Filesystem Technical
Specification.</b></li>
</ul>
<h2><a name="Documentation">Documentation</a></h2>
<p><b><a href="tutorial.html">Tutorial</a></b> - A gentle introduction to
the library, with example programs provided for you to experiment with.</p>
<p><b><a href="reference.html">Reference</a></b> - Formal documentation in the
style of the C++ standard for
every component of the library.</p>
<p><b><a href="faq.htm">FAQ</a></b> - Frequently asked questions.</p>
<p><b><a href="portability_guide.htm">Portability Guide</a></b> - Help for those
concerned with writing code to run on multiple operating systems.</p>
<p><b><a href="deprecated.html">Deprecated Features</a></b> - Identifies
deprecated features and their replacements.</p>
<p><b><a href="v4.html">Version 4 Description</a></b> - Summary of changes from
Version 3.</p>
<p><b><a href="v3.html">Version 3 Introduction</a></b> - Aimed at users of prior
Boost.Filesystem versions.</p>
<p><b><a href="v3_design.html">Version 3 Design</a></b> - Historical document
from the start of the Version 3 design process.</p>
<p><b><a href="design.htm">Original Design</a></b> - Historical document from
the start of the Version 1 design process.</p>
<p><b><a href="do_list.html">Do List</a></b> - Boost.Filesystem development work
in the pipeline.</p>
<h2><a name="Using">Using</a> the library</h2>
<p>Boost.Filesystem is implemented as a separately compiled library, so you must install
binaries in a location that can be found by your linker. If you followed the
<a href="http://www.boost.org/doc/libs/release/more/getting_started/index.html">Boost Getting Started</a> instructions, that's already been done for you.</p>
<h2><a name="Coding-guidelines">Coding guidelines</a></h2>
<p>For new code, defining <code>BOOST_FILESYSTEM_NO_DEPRECATED</code> before
including filesystem headers is strongly recommended. This prevents inadvertent
use of old features, particularly legacy function names, that have been replaced
and are going to go away in the future.</p>
<h2><a name="Cautions">Cautions</a></h2>
<p>After reading the tutorial you can dive right into simple,
script-like programs using the Filesystem Library! Before doing any serious
work, however, there a few cautions to be aware of:</p>
<h4><b>Effects and Postconditions not guaranteed in the presence of race-conditions</b></h4>
<p>Filesystem function specifications follow the C++ Standard Library form, specifying behavior in terms of
effects and postconditions. If
a <a href="reference.html#Race-condition">race-condition</a> exists, a function's
postconditions may no longer be true by the time the function returns to the
caller.</p>
<blockquote>
<p><b><i>Explanation: </i></b>The state of files and directories is often
globally shared, and thus may be changed unexpectedly by other threads,
processes, or even other computers having network access to the filesystem. As an
example of the difficulties this can cause, note that the following asserts
may fail:</p>
<blockquote>
<p><code>assert( exists( &quot;foo&quot; ) == exists( &quot;foo&quot; ) );&nbsp; //
(1)<br>
<br>
remove_all( &quot;foo&quot; );<br>
assert( !exists( &quot;foo&quot; ) );&nbsp; // (2)<br>
<br>
assert( is_directory( &quot;foo&quot; ) == is_directory( &quot;foo&quot; ) ); //
(3)</code></p>
</blockquote>
<p>(1) will fail if a non-existent &quot;foo&quot; comes into existence, or an
existent &quot;foo&quot; is removed, between the first and second call to <i>exists()</i>.
This could happen if, during the execution of the example code, another thread,
process, or computer is also performing operations in the same directory.</p>
<p>(2) will fail if between the call to <i>remove_all()</i> and the call to
<i>exists()</i> a new file or directory named &quot;foo&quot; is created by another
thread, process, or computer.</p>
<p>(3) will fail if another thread, process, or computer removes an
existing file &quot;foo&quot; and then creates a directory named &quot;foo&quot;, between the
example code's two calls to <i>is_directory()</i>.</p>
</blockquote>
<h4>E<b>xceptions</b></h4>
<p>Unless otherwise specified, Boost.Filesystem functions throw <i>
<a href="reference.html#basic_filesystem_error-constructors">basic_filesystem_error</a></i>
exceptions to report failures such as I/O errors. Implementations may also use C++ Standard Library functions
which can throw <i>std::bad_alloc </i>exceptions to report memory allocation
errors. These exceptions may be thrown even
though the error condition leading to the exception is not explicitly specified
in the function's &quot;Throws&quot; paragraph.</p>
<p>Nominally non-throwing versions are provided for
<a href="reference.html#Operational-functions">operational functions</a> that
access the external file system, since these are often used
in contexts where error codes may be the preferred way to report an error. Even
the nominally non-throwing versions of functions will throw <i>std::bad_alloc </i>
exceptions to report memory allocation errors. However, functions marked <code>
noexcept</code> never throw exceptions.</p>
<h2><a name="Headers">Headers</a></h2>
<p>The Boost.Filesystem library provides several&nbsp;headers:</p>
<ul>
<li>Header &lt;<a href="../../../boost/filesystem.hpp">boost/filesystem.hpp</a>&gt;
provides access to all features of the library, except file streams.<br>
&nbsp;</li>
<li>Header &lt;<a href="../../../boost/filesystem/fstream.hpp">boost/filesystem/fstream.hpp</a>&gt;
inherits the same components as the C++ Standard
Library's <i>fstream</i> header, but files are identified by <code>const path&amp;</code>
arguments rather that <code>const char*</code> arguments.</li>
</ul>
<h2><a name="Examples">Example programs</a></h2>
<p>See the <a href="tutorial.html">tutorial</a> for example programs.</p>
<h2><a name="Implementation">Implementation</a></h2>
<p>The current implementation supports operating systems which provide
the POSIX or Windows API's.</p>
<p>The library is in regular use on Apple OS X, HP-UX, IBM AIX, Linux,
Microsoft Windows, SGI IRIX, and Sun Solaris operating systems using a variety
of compilers. It is also used by several smart phone operating systems.</p>
<h2><a name="Macros">Macros</a></h2>
<p>Users may define the following macros if desired. Sensible defaults are
provided, so users can ignore these macros unless they have special needs.</p>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td><b><i>Macro Name</i></b></td>
<td><b><i>Default</i></b></td>
<td><b><i>Effect if defined</i></b></td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_VERSION</code></td>
<td valign="top">3</td>
<td valign="top">Selects the Boost.Filesystem library version. Can have values of 3 or 4.
Defining to 4 also implies <code>BOOST_FILESYSTEM_NO_DEPRECATED</code>.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_NO_DEPRECATED</code></td>
<td valign="top">Not defined.</td>
<td valign="top">Deprecated features are excluded from headers.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DYN_LINK</code></td>
<td valign="top">Defined if <code>BOOST_ALL_DYN_LINK</code> is defined,
otherwise not defined.</td>
<td valign="top">The Boost.Filesystem library is dynamically linked. If not defined,
static linking is assumed.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_NO_LIB</code></td>
<td valign="top">Defined if <code>BOOST_ALL_NO_LIB</code> is defined,
otherwise not defined.</td>
<td valign="top">Boost.Filesystem library does not use the Boost auto-link
facility.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DISABLE_SENDFILE</code></td>
<td valign="top">Not defined. <code>sendfile</code> API presence detected at library build time.</td>
<td valign="top">Boost.Filesystem library does not use the <code>sendfile</code> system call on Linux. The <code>sendfile</code> system call started accepting regular file descriptors as the target in Linux 2.6.33.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DISABLE_COPY_FILE_RANGE</code></td>
<td valign="top">Not defined. <code>copy_file_range</code> API presence detected at library build time.</td>
<td valign="top">Boost.Filesystem library does not use the <code>copy_file_range</code> system call on Linux. The <code>copy_file_range</code> system call was introduced in Linux kernel 4.5 and started operating across filesystems in 5.3.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DISABLE_STATX</code></td>
<td valign="top">Not defined. <code>statx</code> presence detected at library build time.</td>
<td valign="top">Boost.Filesystem library does not use the <code>statx</code> system call on Linux. The <code>statx</code> system call was introduced in Linux kernel 4.11.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DISABLE_GETRANDOM</code></td>
<td valign="top">Not defined. <code>getrandom</code> API presence detected at library build time.</td>
<td valign="top">Boost.Filesystem library does not use the <code>getrandom</code> system call on Linux. The <code>getrandom</code> system call was introduced in Linux kernel 3.17.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DISABLE_ARC4RANDOM</code></td>
<td valign="top">Not defined. <code>arc4random</code> API presence detected at library build time.</td>
<td valign="top">Boost.Filesystem library does not use the <code>arc4random_buf</code> system call on BSD systems. The <code>arc4random</code> API was introduced in OpenBSD 2.1 and FreeBSD 8.0.</td>
</tr>
<tr>
<td valign="top"><code>BOOST_FILESYSTEM_DISABLE_BCRYPT</code></td>
<td valign="top">Not defined. BCrypt API presence detected at library build time.</td>
<td valign="top">Boost.Filesystem library does not use the BCrypt API on Windows. Has no effect on other platforms.</td>
</tr>
</table>
<p>User-defined BOOST_POSIX_API and BOOST_WINDOWS_API macros are no longer
supported.</p>
<h2><a name="Building">Building</a> the object-library</h2>
<p>The object-library will be built automatically if you are using the Boost
build system. See
<a href="../../../more/getting_started.html">Getting Started</a>. It can also be
built manually using a <a href="../build/Jamfile.v2">Jamfile</a>
supplied in directory libs/filesystem/build, or the user can construct an IDE
project or make file which includes the object-library source files.</p>
<p>The object-library source files are
supplied in the <a href="../src">src directory</a>. These source files implement the
library for POSIX or Windows compatible operating systems; no implementation is
supplied for other operating systems. Note that many operating systems not
normally thought of as POSIX systems, such as mainframe legacy
operating systems or embedded operating systems, support POSIX compatible file
systems and so will work with the Filesystem Library.</p>
<p>The object-library can be built for static or dynamic (shared/dll) linking.
This is controlled by the BOOST_ALL_DYN_LINK or BOOST_FILESYSTEM_DYN_LINK
macros. See the <a href="http://www.boost.org/development/separate_compilation.html">Separate
Compilation</a> page for a description of the techniques used.</p>
<h3>Note for <a name="Cygwin">Cygwin</a> users</h3>
<p> <a href="http://www.cygwin.com/">Cygwin</a> version 1.7 or later is
required because only versions of GCC with wide character strings are supported.</p>
<p> The library's implementation code treats Cygwin as a Windows platform, and
thus uses the Windows API and uses Windows path syntax as the native path
syntax.</p>
<h2><a name="Change-history">Version history</a></h2>
<h3>Version 4</h3>
<p><b>Under development</b> - Improve compatibility with std::filesystem introduced in C++17
(original proposal: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html">ISO
C++ File System Technical Specification</a>). The Filesystem TS was based on
Boost.Filesystem Version 3, with only a small number of changes. Most user code
written for Version 3 should work unchanged with Version 4. The differences can be seen in a
<a href="v4.html">separate section</a>.</p>
<h3>Version 3</h3>
<p>Boost 1.44.0 - June, 2010 - Internationalization via single class <code>path</code>.
More uniform error handling.</p>
<p>Peter Dimov suggested use of a single path class rather than a <code>basic_path</code>
class template. That idea was the basis for the Version 3 redesign.</p>
<p>Thanks for comments from Robert Stewart, Zach Laine, Peter Dimov, Gregory
Peele, Scott McMurray, John Bytheway, Jeff Flinn, Jeffery Bosboom.</p>
<h3>Version 2</h3>
<p>Boost 1.34.0 - May, 2007 - Internationalization via <code>basic_path</code>
template.</p>
<p>So many people have contributed comments and bug reports that it isn't any
longer possible to acknowledge them individually. That said, Peter Dimov and Rob
Stewart need to be specially thanked for their many constructive criticisms and
suggestions. Terence
Wilson and Chris Frey contributed timing programs which helped illuminate
performance issues.</p>
<h3>Version 1</h3>
<p>Boost 1.30.0 - March, 2003 - Initial official Boost release.</p>
<p>The Filesystem Library was designed and implemented by Beman Dawes. The
original <i>directory_iterator</i> and <i>filesystem_error</i> classes were
based on prior work from Dietmar Kühl, as modified by Jan Langer. Thomas Witt
was a particular help in later stages of initial development. Peter Dimov and
Rob Stewart made many useful suggestions and comments over a long period of
time. Howard Hinnant helped with internationalization issues.</p>
<p>Key <a href="design.htm#Requirements">design requirements</a> and
<a href="design.htm#Realities">design realities</a> were developed during
extensive discussions on the Boost mailing list, followed by comments on the
initial implementation. Numerous helpful comments were then received during the
Formal Review.<p>Participants included
Aaron Brashears,
Alan Bellingham,
Aleksey Gurtovoy,
Alex Rosenberg,
Alisdair Meredith,
Andy Glew,
Anthony Williams,
Baptiste Lepilleur,
Beman Dawes,
Bill Kempf,
Bill Seymour,
Carl Daniel,
Chris Little,
Chuck Allison,
Craig Henderson,
Dan Nuffer,
Dan'l Miller,
Daniel Frey,
Darin Adler,
David Abrahams,
David Held,
Davlet Panech,
Dietmar Kühl,
Douglas Gregor,
Dylan Nicholson,
Ed Brey,
Eric Jensen,
Eric Woodruff,
Fedder Skovgaard,
Gary Powell,
Gennaro Prota,
Geoff Leyland,
George Heintzelman,
Giovanni Bajo,
Glen Knowles,
Hillel Sims,
Howard Hinnant,
Jaap Suter,
James Dennett,
Jan Langer,
Jani Kajala,
Jason Stewart,
Jeff Garland,
Jens Maurer,
Jesse Jones,
Jim Hyslop,
Joel de Guzman,
Joel Young,
John Levon,
John Maddock,
John Williston,
Jonathan Caves,
Jonathan Biggar,
Jurko,
Justus Schwartz,
Keith Burton,
Ken Hagen,
Kostya Altukhov,
Mark Rodgers,
Martin Schuerch,
Matt Austern,
Matthias Troyer,
Mattias Flodin,
Michiel Salters,
Mickael Pointier,
Misha Bergal,
Neal Becker,
Noel Yap,
Parksie,
Patrick Hartling, Pavel Vozenilek,
Pete Becker,
Peter Dimov,
Rainer Deyke,
Rene Rivera,
Rob Lievaart,
Rob Stewart,
Ron Garcia,
Ross Smith,
Sashan,
Steve Robbins,
Thomas Witt,
Tom Harris,
Toon Knapen,
Victor Wagner,
Vincent Finn,
Vladimir Prus, and
Yitzhak Sapir
<p>A lengthy discussion on the C++ committee's library reflector illuminated the &quot;illusion
of portability&quot; problem, particularly in postings by PJ Plauger and Pete Becker.</p>
<p>Walter Landry provided much help illuminating symbolic link use cases for
version 1.31.0.&nbsp;</p>
<hr>
<p>&copy; Copyright Beman Dawes, 2002-2005</p>
<p>&copy; Copyright Andrey Semashev, 2021</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,222 @@
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem issue reporting</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem Bug Reporting</font>
</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<p>Boost.Filesystem issues such as bug reports or feature requests should be
reported via a <a href="https://github.com/boostorg/filesystem/issues/new">GitHub ticket</a>.</p>
<p><a href="https://github.com/boostorg/filesystem/pulls">GitHub pull requests</a>
are encouraged, too, although anything beyond really trivial fixes needs a
ticket.</p>
<h3>Bug reports</h3>
<p>A timely response to your bug report is much more likely if <b>the problem can
be immediately reproduced without guesswork and regression tests can be easily
created</b>. </p>
<p>You need to provide the following:</p>
<ol>
<li>A simple test program
that:<ul>
<li>Illustrates the problem, and</li>
<li>Automatically yields an unambiguous pass or fail result - returning zero
for pass and non-zero for fail is preferred, and </li>
<li>Can be used as the basis for adding tests to Boost.Filesystem&#39;s
regression test suite.</li>
</ul>
</li>
<li>The compiler, standard library, platform, and Boost version you
used to build and run your test program.</li>
<li>A description of how to build and run the test program.
</li>
<li>A copy of the output from the test
program, if any.</li>
<li>An email address for follow-up questions.</li>
</ol>
<p>See <a href="#Rationale">Rationale</a> to find out why the above is needed.</p>
<p>For a mostly automatic framework to provide the above, read on!</p>
<h3>Bug reporting framework</h3>
<p>The directory <code>&lt;boost-root&gt;/libs/filesystem/bug&gt;</code> provides a bug test program (<code><a href="#bug-cpp">bug.cpp</a></code>)
and a build file (<code>Jamfile.v2</code>). Here is what you need to do:</p>
<ol>
<li>Add one or more test cases to <code><a href="#bug-cpp">bug.cpp</a></code>
using any text or program editor.</li>
<li><a href="#Build-and-test">Build and test</a>.</li>
<li>Attach copies of the <a href="#Test-output">Test output</a> and test
program to the <a href="https://svn.boost.org/trac/boost/newticket">Trac
ticket</a>.</li>
</ol>
<p>That&#39;s it! When you complete those steps, you will be done!</p>
<p>The test output supplies all of the basic information about the compiler, std
library, platform, Boost version, and command line, and the test cases you have
added should make it easy for the library maintainer to reproduce the problem. </p>
<h3>Using the framework</h3>
<h4><a name="bug-cpp"><code>bug.cpp</code></a></h4>
<p>Here is <code>bug.cpp</code> as supplied. To report a real bug, use
<code>BOOST_TEST</code> and <code>BOOST_TEST_EQ</code> macros to build your own
test cases. You can delete the three tests already in <code>bug.cpp</code>:</p>
<blockquote>
<pre>#include &lt;boost/detail/lightweight_test_report.hpp&gt;
#include &lt;boost/filesystem.hpp&gt;
namespace fs = boost::filesystem;
int test_main(int, char*[]) // note name
{
BOOST_TEST(2 + 2 == 5); // one convertible-to-bool argument; this one fails!
BOOST_TEST_EQ(4 + 4, 9); // two EqualityComparible arguments; this one fails!
BOOST_TEST(fs::exists(".")); // should pass, so nothing should be reported
return ::boost::report_errors(); // required
}
</pre>
</blockquote>
<h4><a name="Build-and-test">Build and test</a></h4>
<p>POSIX-like systems:</p>
<blockquote>
<pre>cd &lt;boost-root&gt;/libs/filesystem/bug
../../../b2 -a
bin/bug</pre>
</blockquote>
<p>Windows:</p>
<blockquote>
<pre>cd &lt;boost-root&gt;\libs\filesystem\bug
..\..\..\b2 -a
bin\bug</pre>
</blockquote>
<h4><a name="Test-output">Test output</a></h4>
<p>Running the test on Windows produced this test output:</p>
<blockquote>
<pre>Microsoft Visual C++ version 14.0
Dinkumware standard library version 610
Win32
Boost version 1.58.0
Command line: bin\bug
bug.cpp(10): test '2 + 2 == 5' failed in function
'int __cdecl test_main(int,char *[])'
bug.cpp(11): test '4 + 4 == 9' failed in function
'int __cdecl test_main(int,char *[])': '8' != '9'
2 errors detected.</pre>
</blockquote>
<p>The test framework runs <code>test_main()</code> from a <code>try</code>
block with a <code>catch</code> block that reports exceptions via <code>
std::exception what()</code>. So the output will differ if an exception is
thrown.</p>
<h2>Background information</h2>
<p>You should now have enough information to file an easy-to-reproduce bug
report. So you can skip reading the rest of this page unless you need to do
something a bit out of the ordinary.</p>
<h3><a name="b2-command-line-options"><code>b2</code> command line</a></h3>
<p><code>b2</code> (formerly <code>bjam</code>) usage:&nbsp; <code>b2
[options] [properties] [target]</code></p>
<p>Boost.Build b2 has many options, properties, and targets, but you will not
need most of them for bug reporting. Here are a few you might find helpful:</p>
<p><b>Options</b></p>
<blockquote>
<p><code>-a</code>&nbsp;&nbsp;&nbsp; Rebuild everything rather than
just out-of-date targets. Used in the example build above to ensure libraries
are built with the same setup as the test program.</p>
</blockquote>
<p><b>Properties</b></p>
<blockquote>
<p><code>address-model=<i>n&nbsp; n</i></code> is 32 or 64.
Explicitly request either 32-bit or 64-bit code generation. This typically
requires that your compiler is appropriately configured.</p>
<p><code>variant=</code><i>string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string </i>is
<code>debug</code> or <code>release</code>.</p>
<p><code>toolset=</code><i>string</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The C++
compiler to use. For example, <code>gcc-4.9</code>, <code>clang-3.3</code>,
<code>or msvc-14.0</code>.</p>
<p><code>include=</code><i>string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i>
Additional include paths for C and C++ compilers.</p>
<p><code>cxxflags=</code><i>string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </i>
Custom options to pass to the C++ compiler.</p>
<p><code>define=</code><i>string</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Additional macro definitions for C and C++ compilers. <i>string</i> should be
either <code class="computeroutput">SYMBOL</code> or
<code class="computeroutput">SYMBOL=VALUE</code></p>
</blockquote>
<h3><a name="Rationale">Rationale</a></h3>
<p>Here is the request list again, with rationale added:</p>
<ol>
<li>A simple test program
that:<ul>
<li dir="ltr">
<p dir="ltr">Illustrates the problem <b>[Code communicates more clearly than
prose. If it looks like it will it will take some time to figure out exactly what the
problem is, or worse yet, might result in a wild-goose chase, the bug report
gets set aside to be worked on later and then is often forgotten.] </b>and</li>
<li>Automatically yields an unambiguous pass or fail result - returning zero
for pass and non-zero for fail is preferred <b>[Prevents
miscommunications and allows use in automatic regression tests.]</b>, and </li>
<li>Can be used as the basis for adding tests to Boost.Filesystem&#39;s
regression test suite <b>[With good test cases fixes come easier and
regressions become less likely]</b>.</li>
</ul>
</li>
<li>The compiler, standard library, platform, and Boost version you
used to build and run your test program. <b>[The implementation includes much
platform dependent code, and also depends on the other factors mentioned. Know
these things upfront brings the bug report into focus without having to ask
for more information. ]</b></li>
<li>A description of how to build and run the test program. <b>[If b2
(formerly known as bjam) is used as the build engine, this is not a concern,
but otherwise much more information is needed.]</b></li>
<li>A copy of the output from the test
program, if any. <b>[Avoids misinterpreting results.]</b></li>
<li>An email address for follow-up questions.<b> [Trac comments are the
primary means of response, but it is disheartening when a trac question is not
answered and there is no email address attached for followup.]</b></li>
</ol>
<hr>
<p>&copy; Copyright Beman Dawes, 2014</p>
<p>&copy; Copyright Andrey Semashev, 2019, 2021</p>
<p> Distributed under the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,254 @@
// Generate an HTML table showing path decomposition ---------------------------------//
// Copyright Beman Dawes 2005.
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/filesystem for documentation.
// For purposes of generating the table, support both POSIX and Windows paths
#include "boost/filesystem.hpp"
#include <iostream>
#include <fstream>
using boost::filesystem::path;
using std::string;
using std::cout;
namespace {
std::ifstream infile;
std::ofstream posix_outfile;
std::ifstream posix_infile;
std::ofstream outfile;
bool posix;
const string empty_string;
struct column_base
{
virtual string heading() const = 0;
virtual string cell_value(const path& p) const = 0;
};
struct c0 : public column_base
{
string heading() const { return string("<code>string()</code>"); }
string cell_value(const path& p) const { return p.string(); }
} o0;
struct c1 : public column_base
{
string heading() const { return string("<code>generic_<br>string()</code>"); }
string cell_value(const path& p) const { return p.generic_string(); }
} o1;
struct c2 : public column_base
{
string heading() const { return string("Iteration<br>over<br>Elements"); }
string cell_value(const path& p) const
{
string s;
for (path::iterator i(p.begin()); i != p.end(); ++i)
{
if (i != p.begin())
s += ',';
s += (*i).string();
}
return s;
}
} o2;
struct c3 : public column_base
{
string heading() const { return string("<code>root_<br>path()</code>"); }
string cell_value(const path& p) const { return p.root_path().string(); }
} o3;
struct c4 : public column_base
{
string heading() const { return string("<code>root_<br>name()</code>"); }
string cell_value(const path& p) const { return p.root_name().string(); }
} o4;
struct c5 : public column_base
{
string heading() const { return string("<code>root_<br>directory()</code>"); }
string cell_value(const path& p) const { return p.root_directory().string(); }
} o5;
struct c6 : public column_base
{
string heading() const { return string("<code>relative_<br>path()</code>"); }
string cell_value(const path& p) const { return p.relative_path().string(); }
} o6;
struct c7 : public column_base
{
string heading() const { return string("<code>parent_<br>path()</code>"); }
string cell_value(const path& p) const { return p.parent_path().string(); }
} o7;
struct c8 : public column_base
{
string heading() const { return string("<code>filename()</code>"); }
string cell_value(const path& p) const { return p.filename().string(); }
} o8;
const column_base* column[] = { &o2, &o0, &o1, &o3, &o4, &o5, &o6, &o7, &o8 };
// do_cell ---------------------------------------------------------------//
void do_cell(const string& test_case, int i)
{
string temp = column[i]->cell_value(path(test_case));
string value;
outfile << "<td>";
if (temp.empty())
value = "<font size=\"-1\"><i>empty</i></font>";
else
value = string("<code>") + temp + "</code>";
if (posix)
posix_outfile << value << '\n';
else
{
std::getline(posix_infile, temp);
if (value != temp) // POSIX and Windows differ
{
value.insert(0, "<br>");
value.insert(0, temp);
value.insert(0, "<span style=\"background-color: #CCFFCC\">");
value += "</span>";
}
outfile << value;
}
outfile << "</td>\n";
}
// do_row ------------------------------------------------------------------//
void do_row(const string& test_case)
{
outfile << "<tr>\n";
if (test_case.empty())
outfile << "<td><font size=\"-1\"><i>empty</i></font></td>\n";
else
outfile << "<td><code>" << test_case << "</code></td>\n";
for (int i = 0; i < sizeof(column) / sizeof(column_base&); ++i)
{
do_cell(test_case, i);
}
outfile << "</tr>\n";
}
// do_table ----------------------------------------------------------------//
void do_table()
{
outfile << "<h1>Path Decomposition Table</h1>\n"
"<p>Shaded entries indicate cases where <i>POSIX</i> and <i>Windows</i>\n"
"implementations yield different results. The top value is the\n"
"<i>POSIX</i> result and the bottom value is the <i>Windows</i> result.\n"
"<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n"
"<p>\n";
// generate the column headings
outfile << "<tr><td><b>Constructor<br>argument</b></td>\n";
for (int i = 0; i < sizeof(column) / sizeof(column_base&); ++i)
{
outfile << "<td><b>" << column[i]->heading() << "</b></td>\n";
}
outfile << "</tr>\n";
// generate a row for each input line
string test_case;
while (std::getline(infile, test_case))
{
if (!test_case.empty() && *--test_case.end() == '\r')
test_case.erase(test_case.size() - 1);
if (test_case.empty() || test_case[0] != '#')
do_row(test_case);
}
outfile << "</table>\n";
}
} // unnamed namespace
// main ------------------------------------------------------------------------------//
#define BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
#include <boost/test/included/prg_exec_monitor.hpp>
int cpp_main(int argc, char* argv[]) // note name!
{
if (argc != 5)
{
std::cerr << "Usage: path_table \"POSIX\"|\"Windows\" input-file posix-file output-file\n"
"Run on POSIX first, then on Windows\n"
" \"POSIX\" causes POSIX results to be saved in posix-file;\n"
" \"Windows\" causes POSIX results read from posix-file\n"
" input-file contains the paths to appear in the table.\n"
" posix-file will be used for POSIX results\n"
" output-file will contain the generated HTML.\n";
return 1;
}
infile.open(argv[2]);
if (!infile)
{
std::cerr << "Could not open input file: " << argv[2] << std::endl;
return 1;
}
if (string(argv[1]) == "POSIX")
{
posix = true;
posix_outfile.open(argv[3]);
if (!posix_outfile)
{
std::cerr << "Could not open POSIX output file: " << argv[3] << std::endl;
return 1;
}
}
else
{
posix = false;
posix_infile.open(argv[3]);
if (!posix_infile)
{
std::cerr << "Could not open POSIX input file: " << argv[3] << std::endl;
return 1;
}
}
outfile.open(argv[4]);
if (!outfile)
{
std::cerr << "Could not open output file: " << argv[2] << std::endl;
return 1;
}
outfile << "<html>\n"
"<head>\n"
"<title>Path Decomposition Table</title>\n"
"</head>\n"
"<body bgcolor=\"#ffffff\" text=\"#000000\">\n";
do_table();
outfile << "</body>\n"
"</html>\n";
return 0;
}

View File

@@ -0,0 +1,50 @@
# Paths for the reference.html Path Decomposition Table
#
# This is the input file for path_table, which generates the actual html
#
# Copyright Beman Dawes 2010
#
# Distributed under the Boost Software License, Version 1.0.
# See www.boost.org/LICENSE_1_0.txt
#
# Note that an empty line is treated as input rather than as a comment
.
..
foo
/
/foo
foo/
/foo/
foo/bar
/foo/bar
//net
//net/foo
///foo///
///foo///bar
/.
./
/..
../
foo/.
foo/..
foo/./
foo/./bar
foo/..
foo/../
foo/../bar
c:
c:/
c:foo
c:/foo
c:foo/
c:/foo/
c:/foo/bar
prn:
c:\
c:foo
c:\foo
c:foo\
c:\foo\
c:\foo/
c:/foo\bar

View File

@@ -0,0 +1,241 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Portability Guide</title>
<link href="styles.css" rel="stylesheet">
</head>
<body bgcolor="#FFFFFF">
<h1>
<img border="0" src="../../../boost.png" align="center" width="300" height="86">Path
Name Portability
Guide</h1>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<p>
<a href="#Introduction">Introduction</a><br>
<a href="#name_check_functions">name_check functions</a><br>
<a href="#recommendations">File and directory name recommendations</a></p>
<h2><a name="Introduction">Introduction</a></h2>
<p>Like any other C++ program which performs I/O operations, there is no
guarantee that a program using Boost.Filesystem will be portable between
operating systems. Critical aspects of I/O such as how the operating system
interprets paths are unspecified by the C and C++ Standards.</p>
<p>It is not possible to know if a file or directory name will be
valid (and thus portable) for an unknown operating system. There is always the possibility that an operating system could use
names which are unusual (numbers less than 4096, for example) or very
limited in size (maximum of six character names, for example). In other words,
portability is never absolute; it is always relative to specific operating
systems or
file systems.</p>
<p>It is possible, however, to know in advance if a directory or file name is likely to be valid for a particular
operating system.&nbsp;It is also possible to construct names which are
likely to be portable to a large number of modern and legacy operating systems.</p>
<p>Almost all modern operating systems support multiple file systems. At the
minimum, they support a native file system plus a CD-ROM file system (Generally
ISO-9669, often with Joliet extensions).</p>
<p>Each file system
may have its own naming rules. For example, modern versions of Windows support NTFS, FAT, FAT32, and ISO-9660 file systems, among others, and the naming rules
for those file systems differ. Each file system may also have
differing rules for overall path validity, such as a maximum length or number of
sub-directories. Some legacy systems have different rules for directory names
versus regular file names.</p>
<p>As a result, Boost.Filesystem's <i>name_check</i> functions
cannot guarantee directory and file name portability. Rather, they are intended to
give the programmer a &quot;fighting chance&quot; to achieve portability by early
detection of common naming problems.</p>
<h2><a name="name_check_functions">name_check functions</a></h2>
<p>A <i>name_check</i> function
returns true if its argument is valid as a directory and regular file name for a
particular operating or file system. A number of these functions are provided.</p>
<p>The <a href="#portable_name">portable_name</a> function is of particular
interest because it has been carefully designed to provide wide
portability yet not overly restrict expressiveness.</p>
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<td align="center" colspan="2"><b>Library Supplied name_check Functions</b></td>
</tr>
<tr>
<td align="center"><b>Function</b></td>
<td align="center"><b>Description</b></td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="portable_posix_name">portable_posix_name</a>(const
std::string&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <i>true</i> if <code>!name.empty() &amp;&amp; name</code> contains only the characters
specified in<i> Portable Filename Character Set</i> rules as defined in by
POSIX (<a href="http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html">www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html</a>).<br>
The allowed characters are <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>,
<code>'.'</code>, <code>'_'</code>, and <code>'-'</code>.<p><b>Use:</b>
applications which must be portable to any POSIX system.</td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="windows_name">windows_name</a>(const
std::string&amp;<i> name</i>)</code></td>
<td><b>Returns:</b>&nbsp; <i>true</i> if <code>!name.empty() &amp;&amp; name</code> contains
only the characters specified by the Windows platform SDK as valid
regardless of the file system <code>&amp;&amp; (name</code> is <code>&quot;.&quot;</code> or
<code>&quot;..&quot;</code>&nbsp; or does not end with a trailing space or period<code>)</code>.&nbsp;
The allowed characters are anything except <code>0x0-0x1F</code>, <code>'&lt;'</code>,
<code>'&gt;'</code>, <code>':'</code>, <code>'&quot;'</code>, <code>'/'</code>,
<code>'\'</code>, and <code>'|'</code>.<p>
<b>Use:</b> applications which must be portable to Windows.</p>
<p><b>Note:</b> Reserved device names are not valid as file names, but are
not being detected because they are still valid as a path. Specifically,
CON, PRN, AUX, CLOCK$, NUL, COM[1-9], LPT[1-9], and these names followed by
an extension (for example, NUL.tx7).</td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="portable_name">portable_name</a>(const
std::string&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <code>&nbsp;windows_name(name) &amp;&amp; portable_posix_name(name)
&amp;&amp; (name</code> is <code>&quot;.&quot;</code> or <code>&quot;..&quot;</code>, and the first character not a period or hyphen<code>)</code>.<p><b>Use:</b> applications which must be portable to a wide variety of
modern operating systems, large and small, and to some legacy O/S's. The
first character not a period or hyphen restriction is a requirement of
several older operating systems.</td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="portable_directory_name">
portable_directory_name</a>(const std::string&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <code>portable_name(name) &amp;&amp; (name</code> is <code>&quot;.&quot;</code>
or <code>&quot;..&quot;</code>&nbsp; or contains no periods<code>)</code>.<p><b>Use:</b> applications
which must be portable to a wide variety of platforms, including OpenVMS.</td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="portable_file_name">
portable_file_name</a>(const std::string&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> <code>portable_name(name) &amp;&amp; </code>any period is followed by one to three additional
non-period characters.<p><b>Use:</b>
applications which must be portable to a wide variety of platforms,
including OpenVMS and other systems which have a concept of &quot;file extension&quot;
but limit its length.</td>
</tr>
<tr>
<td align="left" valign="top"><code><a name="native">native</a>(const
std::string&amp;<i> name</i>)</code></td>
<td><b>Returns:</b> Implementation defined. Returns <i>
true</i> for names considered valid by the operating system's native file
systems.<p><b>Note:</b> May return <i>true</i> for some names not considered valid
by the operating system under all conditions (particularly on operating systems which support
multiple file systems.)</td>
</tr>
</table>
<h2>File and directory name <a name="recommendations">recommendations</a></h2>
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<td align="center" valign="top"><strong>Recommendation</strong></td>
<td align="center" valign="top"><strong>Rationale</strong></td>
</tr>
<tr>
<td valign="top">Limit file and directory names to the characters A-Z, a-z, 0-9, period, hyphen, and
underscore.<p>Use any of the &quot;portable_&quot; <a href="#name_check_functions">
name check functions</a> to enforce this recommendation.</td>
<td valign="top">These are the characters specified by the POSIX standard for portable directory and
file names, and are also valid for Windows, Mac, and many other modern file systems.</td>
</tr>
<tr>
<td valign="top">Do not use a period or hyphen as the first
character of a name. Do not use period as the last character of a name.<p>
Use <a href="#portable_name">portable_name</a>,
<a href="#portable_directory_name">portable_directory_name</a>, or
<a href="#portable_file_name">portable_file_name</a> to enforce this
recommendation.</td>
<td valign="top">Some operating systems treat have special rules for the
first character of names. POSIX, for example. Windows does not permit period
as the last character.</td>
</tr>
<tr>
<td valign="top">Do not use periods in directory names.<p>Use
<a href="#portable_directory_name">portable_directory_name</a> to enforce
this recommendation.</td>
<td valign="top">Requirement for ISO-9660 without Juliet extensions, OpenVMS filesystem, and other legacy systems.</td>
</tr>
<tr>
<td valign="top">Do not use more that one period in a file name, and limit
the portion after the period to three characters.<p>Use
<a href="#portable_file_name">portable_file_name</a> to enforce this
recommendation.</td>
<td valign="top">Requirement for ISO-9660 level 1, OpenVMS filesystem, and
other legacy systems. </td>
</tr>
<tr>
<td valign="top">Do not assume names are case sensitive. For example, do not expected a directory to be
able to hold separate elements named &quot;Foo&quot; and &quot;foo&quot;. </td>
<td valign="top">Some file systems are case insensitive.&nbsp; For example, Windows
NTFS is case preserving in the way it stores names, but case insensitive in
searching for names (unless running under the POSIX sub-system, it which
case it does case sensitive searches). </td>
</tr>
<tr>
<td valign="top">Do not assume names are case insensitive.&nbsp; For example, do not expect a file
created with the name of &quot;Foo&quot; to be opened successfully with the name of &quot;foo&quot;.</td>
<td valign="top">Some file systems are case sensitive.&nbsp; For example, POSIX.</td>
</tr>
<tr>
<td valign="top">Don't use hyphens in names.</td>
<td valign="top">ISO-9660 level 1, and possibly some legacy systems, do not permit
hyphens.</td>
</tr>
<tr>
<td valign="top">Limit the length of the string returned by path::string() to
255 characters.&nbsp;
Note that ISO 9660 has an explicit directory tree depth limit of 8, although
this depth limit is removed by the Juliet extensions.</td>
<td valign="top">Some operating systems place limits on the total path length.&nbsp; For example,
Windows 2000 limits paths to 260 characters total length.</td>
</tr>
<tr>
<td valign="top">Limit the length of any one name in a path.&nbsp; Pick the specific limit according to
the operating systems and or file systems you wish portability to:<br>
&nbsp;&nbsp; Not a concern::&nbsp; POSIX, Windows, MAC OS X.<br>
&nbsp;&nbsp; 31 characters: Classic Mac OS<br>
&nbsp;&nbsp; 8 characters + period + 3 characters: ISO 9660 level 1<br>
&nbsp;&nbsp; 32 characters: ISO 9660 level 2 and 3<br>
&nbsp;&nbsp; 128 characters (64 if Unicode): ISO 9660 with Juliet extensions</td>
<td valign="top">Limiting name length can markedly reduce the expressiveness of file names, yet placing
only very high limits on lengths inhibits widest portability.</td>
</tr>
</table>
<hr>
<p>&copy; Copyright Beman Dawes, 2002, 2003</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,509 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem Relative Proposal</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem Relative<br>
Draft Proposal</font>
</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<p><a href="#Introduction">
Introduction</a><br>
&nbsp;&nbsp;&nbsp; <a href="#Acknowledgement">Acknowledgement</a><br>
&nbsp;&nbsp; &nbsp;<a href="#Preliminary-implementation">Preliminary implementation</a><br>
<a href="#Requirements">Requirements</a><br>
<a href="#Issues">Issues</a><br>
<a href="#Design-decisions">
Design decisions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Provide-separate-relative">Provide separate lexical and
operational <code>relative</code> functions</a><br>
&nbsp;&nbsp;&nbsp; <a href="#Provide-separate-proximate">Provide
separate lexical and operational <code>proximate</code> functions</a><br>
&nbsp;&nbsp;&nbsp; <a href="#Add-lexical-functions">Add lexical functions as <code>path</code> member functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Provide-normal">Provide a non-member function
<code>lexically_normal</code> returning a
normal form path</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Provide-weakly">Provide a <code>weakly_canonical</code> operational function</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#just-work">Resolve issues in ways that &quot;just work&quot; for users</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mismatch">Specify <code>lexical relative</code> in terms
of <code>std::mismatch</code></a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Specify-op-rel-weakly">Specify operational <code>relative</code> in terms of <code>
weakly_canonical</code></a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Specify-op-rel-lex-rel">Specify operational <code>relative</code> in terms of
<code>lexically
relative</code></a><br>
<a href="#Proposed-wording">Proposed wording</a><br>
&nbsp;&nbsp;&nbsp; <a href="#Define-normal-form">Define <i>normal form</i></a><br>
&nbsp;&nbsp;&nbsp; <a href="#New-class-path-member-functions">New class path member functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#Synopsis-path">Synopsis</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#Specification-path">Specification</a><br>
&nbsp;&nbsp;&nbsp; <a href="#operational-functions">New operational functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#Synopsis-ops">Synopsis</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#Specification-ops">Specification</a></p>
<h2>
<a name="Introduction">Introduction</a></h2>
<p>There have been requests for a Filesystem library relative function for at
least ten years.</p>
<p>
The requested functionality seems simple - given two paths with a common
prefix, return the non-common suffix portion of one of the paths such that
it is relative to the other path.</p>
<p>
In terms of the Filesystem library,</p>
<blockquote>
<pre>path p(&quot;/a/b/c&quot;);
path base(&quot;/a/b&quot;);
path rel = relative(p, base); // the requested function
cout &lt;&lt; rel &lt;&lt; endl; // outputs &quot;c&quot;
assert(absolute(rel, base) == p);</pre>
</blockquote>
<p>If that was all there was to it, the Filesystem library would have had a
<code>relative</code> function years ago.</p>
<blockquote>
<p>Blocking issues: Clashing requirements, symlinks, directory placeholders (<i>dot</i>,
<i>dot-dot</i>), user-expectations, corner cases.</p>
</blockquote>
<h3><a name="Acknowledgement">Acknowledgement</a></h3>
<p>A paper by Jamie Allsop, <i>Additions to Filesystem supporting Relative Paths</i>,
is what broke my mental logjam. Much of what follows is based directly on
Jamie&#39;s analysis and proposal. The <code>weakly_canonical</code> function and
aspects of the semantic specifications are my contributions. Mistakes, of
course, are mine.</p>
<h3><a name="Preliminary-implementation">Preliminary implementation</a></h3>
<p>A preliminary implementation is available in the
<a href="https://github.com/boostorg/filesystem/tree/feature/relative2">
feature/relative2</a> branch of the Boost Filesystem Git repository. See
<a href="https://github.com/boostorg/filesystem/tree/feature/relative2">
github.com/boostorg/filesystem/tree/feature/relative2</a></p>
<h2><a name="Requirements">Requirements</a></h2>
<b><a name="Requirement-1">Requirement 1</a>:</b> Some uses require symlinks be followed; i.e. the path must be resolved in
the actual file system.<p><b><a name="Requirement-2">Requirement 2</a>: </b>Some uses require symlinks not be followed; i.e. the path must not be
resolved in the actual file system.</p>
<b><a name="Requirement-3">Requirement 3</a>: </b>Some uses require removing redundant current directory (<i>dot</i>)
or parent directory (<i>dot-dot</i>) placeholders.<p><b>
<a name="Requirement-4">Requirement 4</a>: </b>Some uses do not require removing redundant current directory (<i>dot</i>)
or parent directory (<i>dot-dot</i>) placeholders since the path is known to
be
already in normal form.</p>
<h2><a name="Issues">Issues</a></h2>
<p><b><a name="Issue-1">Issue 1</a>:</b> What happens if <code>p</code>
and <code>base</code> are themselves relative?</p>
<b><a name="Issue-2">Issue 2</a>:</b> What happens if there is no common prefix? Is this an error, the whole of
<code>p</code> is relative to <code>base</code>, or something else?<p><b>
<a name="Issue-3">Issue 3</a>:</b> What happens if <code>p</code>, <code>base</code>, or both are empty?</p>
<b><a name="Issue-4">Issue 4</a>:</b> What happens if <code>p</code> and <code>base</code> are the same?<p>
<b><a name="Issue-5">Issue 5</a>:</b> How is the &quot;common prefix&quot; determined?</p>
<b><a name="Issue-6">Issue 6</a>:</b> What happens if portions of <code>p</code> or <code>base</code> exist but
the entire path does not exist and yet symlinks need to be followed?<p><b>
<a name="Issue-7">Issue 7</a>:</b> What happens when a symlink in the existing portion of a path is affected
by a directory (<i>dot-dot</i>) placeholder in a later non-existent portion of
the path?</p>
<p><b><a name="Issue-8">Issue 8</a>:</b> Overly complex semantics (and thus
specifications) in preliminary designs made reasoning about uses difficult.</p>
<p><b><a name="Issue-9">Issue 9</a>: </b>Some uses never have redundant current directory (<i>dot</i>)
or parent directory (<i>dot-dot</i>) placeholders, so a removal operation
would be an unnecessary expense although otherwise harmless.</p>
<h2>
<a name="Design-decisions">Design decisions</a></h2>
<h4>
<a name="Provide-separate-relative">Provide separate</a> lexical and
operational <code>relative</code> functions</h4>
<p align="left">
Resolves the conflict between <a href="#Requirement-1">requirement 1</a>
and <a href="#Requirement-2">requirement 2</a> and ensures both
requirements are met.</p>
<p>
A purely lexical function is needed by users working with directory
hierarchies that do not actually exist.</p>
<p>
An operational function that queries the current file system for existence
and follows symlinks is needed by users working with actual existing
directory hierarchies.</p>
<h4>
<a name="Provide-separate-proximate">Provide separate</a> lexical and operational
<code>proximate</code> functions</h4>
<p>
Although not the only possibility, a likely fallback when the relative
functions cannot find a relative path is to return the path being made relative. As
a convenience, the <code>proximate</code> functions do just that.</p>
<h4>
<a name="Add-lexical-functions">Add lexical functions as
<code>path</code> member functions</a></h4>
<p dir="ltr">
The Filesystem library is unusual in that it has several functions with
both lexical (i.e. cheap) and operational (i.e. expensive due to file
system access) forms with differing semantics. It is important that users
choose the form that meets their application&#39;s specific needs. The library
has always made the distinction via the convention of lexical functions
being members of class <code>path</code>, while operational functions are
non-member functions. The lexical functions proposed here also use the
name prefix <code>lexically_</code> to drive home the distinction.</p>
<p>
For the contrary argument, see Sutter and Alexandrescu, <i>C++ Coding Standards</i>, 44:
&quot;Prefer writing nonmember nonfriend functions&quot;, and Meyers, <i>Effective C++ Third Edition</i>, 23:
&quot;Prefer non-member non-friend functions to member functions.&quot;</p>
<h4>
<a name="Provide-normal">Provide</a><b> </b>a non-member function <code>
<a href="#normal">lexically_normal</a></code> returning a
<a href="#normal-form">normal form</a> path</h4>
<p>
Enables resolution of <a href="#Requirement-3">requirement 3</a> and
<a href="#Requirement-4">requirement 4</a> in a way consistent with
<a href="#Issue-9">issue 9</a>. Is a contributor to the resolution of
<a href="#Issue-8">issue 8</a>.</p>
<p>
&quot;Normalization&quot; is the process of removing redundant current directory (<i>dot</i>)
, parent
directory (<i>dot-dot</i>), and directory separator elements.</p>
<p>
Normalization is a byproduct the current <code>canonical</code> function.
But for the path returned by the
proposed <code><a href="#weakly_canonical">weakly_canonical</a></code> function,
only any leading canonic portion is in canonical form. So any trailing
portion of the returned path has not been normalized.</p>
<p>
Jamie Allsop has proposed adding a separate normalization function returning a
path, and I agree with him.</p>
<p>
Boost.filesystem has a deprecated non-const normalization function that
modifies the path, but I agree with Jamie that a function returning a path
is a better solution.</p>
<h4>
<a name="Provide-weakly">Provide</a><b> </b>a <code><a href="#weakly_canonical">weakly_canonical</a></code> operational function</h4>
<p>
Resolves <a href="#Issue-6">issue 6</a>, <a href="#Issue-7">issue 7</a>,
<a href="#Issue-9">issue 9</a>, and is a contributor to the resolution of
<a href="#Issue-8">issue 8</a>.</p>
<p>
The operational function
<code>weakly_canonical(p)</code> returns a path composed of <code>
canonical(x)/y</code>, where <code>x</code> is a path composed of the
longest leading sequence of elements in <code>p</code> that exist, and
<code>y</code> is a path composed of the remaining trailing non-existent elements of
<code>p</code> if any. &quot;<code>weakly</code>&quot; refers to weakened existence
requirements compared to the existing canonical function.</p>
<ul>
<li>Having <code>weakly_canonical</code> as a separate function, and then
specifying the processing of operational <code>relative</code> arguments in
terms of calls to <code>weakly_canonical</code> makes it much easier to
specify the operational <code>relative</code> function and reason about it.
The difficulty of reasoning about operational <code>relative</code>
semantics before the invention of <code>weakly_canonical</code> was what led to its
initial development.</li>
<li>Having <code>weakly_canonical</code> as a separate function also allows
use in other contexts.</li>
<li>Specifying the return be in <a href="#normal-form">normal form</a> is an
engineering trade-off to resolve <a href="#Issue-7">issue 7</a> in a way that
just works for most use cases.</li>
<li>Specifying normative encouragement to not perform unneeded normalization
is a reasonable resolution for <a href="#Issue-9">issue 9</a>.</li>
</ul>
<h4>
Resolve issues in ways that &quot;<a name="just-work">just work</a>&quot; for users</h4>
<p>
Resolves issues <a href="#Issue-1">1</a>, <a href="#Issue-2">2</a>,
<a href="#Issue-3">3</a>, <a href="#Issue-4">4</a>, <a href="#Issue-7">6</a>,
and <a href="#Issue-7">7</a>. Is a contributor to the resolution of
<a href="#Issue-8">issue 8</a>.</p>
<p>
The &quot;just works&quot; approach was suggested by Jamie Allsop. It is implemented
by specifying a reasonable return value for all of the &quot;What happens
if...&quot; corner case issues, rather that treating them as hard errors
requiring an exception or error code.</p>
<h4>
Specify <a href="#lex-proximate"><code>lexically relative</code></a> in terms
of <code>std::<a name="mismatch">mismatch</a></code></h4>
<p>
Resolves <a href="#Issue-5">issue 5</a>. Is a contributor to the
resolution of <a href="#Issue-8">issue 8</a>.</p>
<h4>
<a name="Specify-op-rel-weakly">Specify</a> <a href="#op-proximate">operational <code>relative</code></a> in terms of <code>
<a href="#weakly_canonical">weakly_canonical</a></code></h4>
<p>
Is a contributor to the resolution of <a href="#Issue-8">issue 8</a>.</p>
<ul>
<li>Covers a wide range of uses cases since a single function works for
existing, non-existing, and partially existing paths.</li>
<li>Works correctly for partially existing paths that contain symlinks.</li>
</ul>
<h4>
<a name="Specify-op-rel-lex-rel">Specify</a> <a href="#op-proximate">operational <code>relative</code></a> in terms of
<a href="#lex-proximate"><code>lexically
relative</code></a></h4>
<p>
Is a contributor to the resolution of <a href="#Issue-5">issue 5</a> and
<a href="#Issue-8">issue 8</a>.</p>
<p>
If would be confusing to users and difficult to specify correctly if the
two functions had differing semantics:</p>
<ul>
<li>When either or both paths are empty.</li>
<li>When all elements of the two paths match exactly.</li>
<li>Because different matching algorithms were used.</li>
<li>Because although the same matching algorithm was used, it was applied in different ways.</li>
</ul>
<p>
These problems are avoided by specifying operational <code>relative</code>
in terms of lexical <code>relative</code> after preparatory
calls to operational functions.</p>
<h2><a name="Proposed-wording">Proposed wording</a></h2>
<p><span style="background-color: #DBDBDB"><i>&quot;Overview:&quot; sections below are
non-normative experiments attempting to make the normative reference
specifications easier to grasp.</i></span></p>
<h3><a name="Define-normal-form">Define <i>normal form</i></a></h3>
<p>A path is in <b><i><a name="normal-form">normal form</a></i></b> if it has no
redundant current directory (<i>dot</i>) or parent directory (<i>dot-dot</i>)
elements. The normal form for an empty path is an empty path. The normal form
for a path ending in a <i>directory-separator</i> that is not the root directory
is the same path with a current directory (<i>dot</i>) element appended.</p>
<p><span style="background-color: #DBDBDB"><i>The last sentence above is not
necessary for POSIX-like or Windows-like operating systems, but supports systems
like OpenVMS that use different syntax for directory and regular-file names.</i></span></p>
<h3><a name="New-class-path-member-functions">New class path member functions</a></h3>
<h4><a name="Synopsis-path">Synopsis</a></h4>
<pre>path lexically_normal() const;
path lexically_relative(const path&amp; base) const;
path lexically_proximate(const path&amp; base) const;</pre>
<h4><a name="Specification-path">Specification</a></h4>
<pre>path <a name="lex-normal">lexically_normal</a>() const;</pre>
<blockquote>
<p><i>Overview:</i> Returns <code>*this</code> with redundant current directory
(<i>dot</i>), parent directory (<i>dot-dot</i>), and <i>directory-separator</i> elements removed.</p>
<p><i>Returns:</i> <code>*this</code> in <a href="#normal-form">normal form</a>.</p>
<p><i>Remarks:</i> Uses <code>operator/=</code> to compose the returned path.</p>
<p>[<i>Example:</i></p>
<p><code>assert(path(&quot;foo/./bar/..&quot;).lexically_normal() == &quot;foo&quot;);<br>
assert(path(&quot;foo/.///bar/../&quot;).lexically_normal() == &quot;foo/.&quot;);</code></p>
<p>The above assertions will succeed.<i> </i>On Windows, the
returned path&#39;s <i>directory-separator</i> characters will be backslashes rather than slashes, but that
does not affect <code>path</code> equality.<i> —end example</i>]</p>
</blockquote>
<pre>path <a name="lex-relative">lexically_relative</a>(const path&amp; base) const;</pre>
<blockquote>
<p><i>Overview:</i> Returns <code>*this</code> made relative to <code>base</code>.
Treats empty or identical paths as corner cases, not errors. Does not resolve
symlinks. Does not first normalize <code>*this</code> or <code>base</code>.</p>
<p><i>Remarks:</i> Uses <code>std::mismatch(begin(), end(), base.begin(), base.end())</code>, to determine the first mismatched element of
<code>*this</code> and <code>base</code>. Uses <code>operator==</code> to
determine if elements match. </p>
<p><i>Returns:</i> </p>
<ul>
<li>
<code>path()</code> if the first mismatched element of <code>*this</code> is equal to <code>
begin()</code> or the first mismatched element
of <code>base</code> is equal to <code>base.begin()</code>, or<br>&nbsp;
</li>
<li>
<code>path(&quot;.&quot;)</code> if the first mismatched element of <code>
*this</code> is equal to <code>
end()</code> and the first mismatched element
of <code>base</code> is equal to <code>base.end()</code>, or<br>&nbsp;
</li>
<li>An object of class <code>path</code> composed via application of <code>
operator/= path(&quot;..&quot;)</code> for each element in the half-open
range [first
mismatched element of <code>base</code>, <code>base.end()</code>), and then
application of <code>operator/=</code> for each element in the half-open
range
[first mismatched element of <code>*this</code>, <code>end()</code>).
</li>
</ul>
<p>[<i>Example:</i></p>
<p><code>assert(path(&quot;/a/d&quot;).lexically_relative(&quot;/a/b/c&quot;) == &quot;../../d&quot;);<br>
assert(path(&quot;/a/b/c&quot;).lexically_relative(&quot;/a/d&quot;) == &quot;../b/c&quot;);<br>
assert(path(&quot;a/b/c&quot;).lexically_relative(&quot;a&quot;) == &quot;b/c&quot;);<br>
assert(path(&quot;a/b/c&quot;).lexically_relative(&quot;a/b/c/x/y&quot;) == &quot;../..&quot;);<br>
assert(path(&quot;a/b/c&quot;).lexically_relative(&quot;a/b/c&quot;) == &quot;.&quot;);<br>
assert(path(&quot;a/b&quot;).lexically_relative(&quot;c/d&quot;) == &quot;&quot;);</code></p>
<p>The above assertions will succeed.<i> </i>On Windows, the
returned path&#39;s <i>directory-separator</i>s will be backslashes rather than
forward slashes, but that
does not affect <code>path</code> equality.<i> —end example</i>]</p>
<p>[<i>Note:</i> If symlink following semantics are desired, use the operational function <code>
<a href="#op-proximate">relative</a></code>&nbsp; <i>—end note</i>]</p>
<p>[<i>Note:</i> If <a href="#normal">normalization</a> is needed to ensure
consistent matching of elements, apply <code><a href="#normal">lexically_normal()</a></code>
to <code>*this</code>, <code>base</code>, or both. <i>—end note</i>]</p>
</blockquote>
<pre>path <a name="lex-proximate">lexically_proximate</a>(const path&amp; base) const;</pre>
<blockquote>
<p><i>Returns:</i> If the value of <code>lexically_relative(base)</code> is
not an empty path, return it. Otherwise return <code>*this</code>.</p>
<p>[<i>Note:</i> If symlink following semantics are desired, use the operational function
<code><a href="#op-proximate">proximate</a></code>&nbsp; <i>—end note</i>]</p>
<p>[<i>Note:</i> If <a href="#normal">normalization</a> is needed to ensure
consistent matching of elements, apply <code><a href="#normal">lexically_normal()</a></code>
to <code>*this</code>, <code>base</code>, or both. <i>—end note</i>]</p>
</blockquote>
<h3>New <a name="operational-functions">operational functions</a></h3>
<h4><a name="Synopsis-ops">Synopsis</a></h4>
<pre>path weakly_canonical(const path&amp; p);
path weakly_canonical(const path&amp; p, system::error_code&amp; ec);
path relative(const path&amp; p, system::error_code&amp; ec);
path relative(const path&amp; p, const path&amp; base=current_path());
path relative(const path&amp; p, const path&amp; base, system::error_code&amp; ec);
path proximate(const path&amp; p, system::error_code&amp; ec);
path proximate(const path&amp; p, const path&amp; base=current_path());
path proximate(const path&amp; p, const path&amp; base, system::error_code&amp; ec);
</pre>
<h4><a name="Specification-ops">Specification</a></h4>
<pre>path <a name="weakly_canonical">weakly_canonical</a>(const path&amp; p);
path weakly_canonical(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<i>Overview:</i> Returns <code>p</code> with symlinks resolved and the result
normalized.<p>
<i>Returns: </i>
A path composed of the result of calling the <code>canonical</code> function on
a path composed of the leading elements of <code>p</code> that exist, if any,
followed by the elements of <code>p</code> that do not exist, if any.</p>
<p><i>Postcondition:</i> The returned path is in <a href="#normal">normal form</a>.</p>
<p><i>Remarks:</i> Uses <code>operator/=</code> to compose the returned path.
Uses the <code>status</code> function to determine existence.</p>
<p><i>Remarks:</i> Implementations are encouraged to avoid unnecessary
normalization such as when <code>canonical</code> has already been called on the
entirety of <code>p</code>.</p>
<p><i>Throws:</i>&nbsp; As specified in Error reporting.</p>
</blockquote>
<pre>path <a name="op-relative">relative</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Returns:</i> <code>relative(p, current_path(), ec)</code>.</p>
<p><i>Throws:</i>&nbsp; As specified in Error reporting.</p>
</blockquote>
<pre>path relative(const path&amp; p, const path&amp; base=current_path());
path relative(const path&amp; p, const path&amp; base, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Overview:</i> Returns <code>p</code> made relative to <code>
base</code>. Treats empty or identical paths as corner cases, not errors.
Resolves symlinks and normalizes both <code>p</code> and <code>base</code>
before other processing.</p>
<p><i>Returns:</i> <code><a href="#weakly_canonical">weakly_canonical</a>(p).l<a href="#lex-proximate">exically_relative</a>(<a href="#weakly_canonical">weakly_canonical</a>(base))</code>. The second form returns <code>path()</code> if an error occurs.</p>
<p><i>Throws:</i> As specified in Error reporting.</p>
</blockquote>
<pre>path <a name="op-proximate">proximate</a>(const path&amp; p, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Returns:</i> <code>proximate(p, current_path(), ec)</code>.</p>
<p><i>Throws:</i>&nbsp; As specified in Error reporting.</p>
</blockquote>
<pre>path proximate(const path&amp; p, const path&amp; base=current_path());
path proximate(const path&amp; p, const path&amp; base, system::error_code&amp; ec);</pre>
<blockquote>
<p><i>Returns:</i> <code><a href="#weakly_canonical">weakly_canonical</a>(p).l<a href="#lex-proximate">exically_proximate</a>(<a href="#weakly_canonical">weakly_canonical</a>(base))</code>. The second form returns <code>path()</code> if an error occurs.</p>
<p><i>Throws:</i> As specified in Error reporting.</p>
</blockquote>
<hr>
<p>&copy; Copyright Beman Dawes 2015</p>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,630 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem Release History</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem Release History</font>
</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports</a>&nbsp;&nbsp;
</td>
</table>
<h2>1.79.0</h2>
<ul>
<li><b>v3:</b> <code>path::replace_extension</code> now works in terms of <b>v3</b> definition of <code>path::extension</code> rather than <b>v4</b>.</li>
<li>Fixed compilation of path appending and concatenation operators with arguments of types convertible to <code>path</code> or compatible string type. (<a href="https://github.com/boostorg/filesystem/issues/223">#223</a>)</li>
<li>On POSIX systems that support <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopendir.html"><code>fdopendir</code></a> and <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html"><code>O_NOFOLLOW</code></a> and on Windows, <code>remove_all</code> is now protected against <a href="https://www.cve.org/CVERecord?id=CVE-2022-21658">CVE-2022-21658</a>. The vulnerability is a race condition that allows a third party process to replace a directory that is being concurrently processed by <code>remove_all</code> with a directory symlink and cause <code>remove_all</code> to follow the symlink and remove files in the linked directory instead of removing the symlink itself. (<a href="https://github.com/boostorg/filesystem/issues/224">#224</a>)</li>
<li>On Windows, in <code>remove</code> and <code>remove_all</code> implementation, use POSIX semantics for file removal, when supported by the OS (Windows 10 1709 and later). When POSIX semantics is supported, the file name is removed from the filesystem namespace as soon as the file is marked for deletion, even if it is still open and in use. With legacy Windows semantics, the file name remains present in the the filesystem namespace until the last file handle to the file is closed, which allows the file marked for deletion to be opened and prevents creating new files with the same name. (<a href="https://github.com/boostorg/filesystem/issues/216">#216</a>)</li>
<li>On Windows, <code>remove</code> and <code>remove_all</code> now support deleting read-only directories. Support for removing read-only non-directory files was added previously.</li>
<li>On Windows, <code>directory_iterator</code> internal implementation has been reworked to better utilize modern Windows APIs, which may improve performance while handling symlinks.</li>
<li>On Windows, initialize internal WinAPI function pointers early, if possible, to allow Boost.Filesystem operations to be invoked in global constructors. This is only supported on MSVC, GCC, Clang and compatible compilers.</li>
<li>On Windows, <code>resize_file</code> should no longer fail with an error if the file to be resized is opened.</li>
<li>Disabled use of the <code>statx</code> syscall on Android prior to 11.0 (API version 30). The syscall is blacklisted by seccomp and causes process termination in runtime. (<a href="https://github.com/boostorg/filesystem/issues/229">#229</a>)</li>
<li><b>Deprecated:</b> <code>boost/filesystem/string_file.hpp</code> header is deprecated and will be removed in a future release. The header is no longer included by <code>boost/filesystem.hpp</code> by default. Users are advised to implement the functionality themselves or migrate to other implementations.</li>
<li><b>Deprecated:</b> Windows CE support is deprecated and will be removed in a future release. Windows CE has been untested for many years and is likely non-functional.</li>
</ul>
<h2>1.78.0</h2>
<ul>
<li><b>v4:</b> <code>path::filename</code> and <code>path::iterator</code> no longer return an implicit trailing dot (".") element if the path ends with a directory separator. Instead, an empty path is returned, similar to C++17 std::filesystem. This also affects other methods that are defined in terms of iterators or filename, such as <code>path::stem</code>, <code>path::compare</code> or <code>lexicographical_compare</code>. For example, <code>path("a/b/") == path("a/b/.")</code> no longer holds true. (<a href="https://github.com/boostorg/filesystem/issues/193">#193</a>)</li>
<li><b>v4:</b> <code>path::lexically_normal</code> no longer produce a trailing dot (".") element and omits a directory separator after a trailing dot-dot ("..") element in the normalized paths.</li>
<li><b>v4:</b> <code>path</code> append operations now consider root name and root directory in the appended path. If the appended path is absolute, or root name is present and differs from the source path, the resulting path is equivalent to the appended path. If root directory is present, the result is the root directory and
relative path rebased on top of the root name of the source path. Otherwise, the behavior is similar to v3. (<a href="https://github.com/boostorg/filesystem/issues/214">#214</a>)</li>
<li><code>path::lexically_normal</code> now converts directory separators to preferred separators in the root name of the normalized paths.</li>
<li>Optimized overloads of <code>path::assign</code>, <code>path::append</code>, <code>path::concat</code> and the corresponding operators to avoid unnecessary path copying and reduce the amount of code redundancy.</li>
<li>On POSIX systems, fixed <code>absolute(p, base)</code> returning a path with root name <code>base.root_name()</code> if <code>p</code> starts with a root directory. In such a case <code>p</code> is already an absolute path and should be returned as is.</li>
<li><code>create_directories</code> no longer reports an error if the input path consists entirely of dot (".") and dot-dot ("..") elements. The implementation is no longer using recursion internally and therefore is better protected from stack overflow on extremely long paths.</li>
<li>On Windows, <code>remove</code> now supports deleting read-only files. The operation will attempt to reset the read-only attribute prior to removal. Note that this introduces a possibility of the read-only attribute being left unset, if the operation fails and the original value of the attribute fails to be restored. This also affects <code>remove_all</code>. (<a href="https://github.com/boostorg/filesystem/issues/216">#216</a>)</li>
<li><code>remove_all</code> now returns <code>static_cast&lt; uintmax_t &gt;(-1)</code> in case of error, similar to C++17 std::filesystem.</li>
<li>Fixed a linking error about unresolved references to Boost.ContainerHash functions when user's code includes <code>boost/filesystem/path.hpp</code> but not <code>boost/container_hash/hash.hpp</code> and the compiler is set to preserve unused inline functions. (<a href="https://github.com/boostorg/filesystem/issues/215">#215</a>)</li>
<li>Added a workaround for MSVC and compatible compilers eliminating path globals cleanup in release builds. This could lead to a memory leak if Boost.Filesystem shared library was repeatedly loaded and unloaded in the process. (<a href="https://github.com/boostorg/filesystem/issues/217">#217</a>)</li>
</ul>
<h2>1.77.0</h2>
<ul>
<li><b>Introducing Boost.Filesystem v4.</b> This new version of the library removes all deprecated features of v3 and also makes a number of breaking API changes intended to make Boost.Filesystem more compatible with std::filesystem introduced in C++17. The differences are described in the release notes and documentation using <b>v3</b> and <b>v4</b> tags and are also summarised in a <a href="v4.html">separate section</a>. Users can select Boost.Filesystem version by defining <code>BOOST_FILESYSTEM_VERSION</code> macro to either 3 or 4 when compiling their code. There is no need to separately compile Boost.Filesystem for each library version &mdash; a single binary supports both v3 and v4. Users should avoid using both v3 and v4 in the same application as this can lead to subtle bugs. Currently, v3 is the default. In a future release v4 will become the default, and eventually v3 will be removed. v4 is functional, but it is still a work in progress and there may be breaking API changes in the future.</li>
<li><b>v4:</b> <code>path::filename</code>, <code>path::stem</code> and <code>path::extension</code> no longer consider root name or root directory of the path as a filename if the path only consists of those components. For example, on Windows <code>path("C:").filename()</code> used to return "C:" and <code>path("C:\\").filename()</code> used to return "\" and both will return an empty path now. (<a href="https://github.com/boostorg/filesystem/issues/88">#88</a>, <a href="https://github.com/boostorg/filesystem/issues/194">#194</a>)</li>
<li><b>v4:</b> <code>path::stem</code> and <code>path::extension</code> no longer treat a filename that starts with a dot and has no other dots as an extension. Filenames starting with a dot are commonly treated as filenames with an empty extension. The leading dot is used to indicate a hidden file on most UNIX-like systems. (<a href="https://github.com/boostorg/filesystem/issues/88">#88</a>)</li>
<li><b>New:</b> Improved support for various path prefixes on Windows. Added support for local device prefix ("\\.\") and experimental support for NT path prefix ("\??\"). The prefixes will be included in the root name of a path. Note that using the prefixes with Boost.Filesystem v3 can lead to surprising results (e.g. <code>path("\\\\.\\").stem() == "\\\\"</code>). It is recommended to use the prefixes only with Boost.Filesystem v4.</li>
<li>Reworked <code>path::lexically_normal</code> implementation to eliminate some cases of duplicate dot (".") elements in the normalized paths.</li>
<li><b>New:</b> Added runtime detection of the <code>statx</code> and <code>getrandom</code> system calls on Linux. This can be useful if the syscall is present at compile time but fails with <code>ENOSYS</code> at run time (for example, in Docker containers that restrict the syscall, even if available on the host). (<a href="https://github.com/boostorg/filesystem/issues/172">#172</a>)</li>
<li><b>New:</b> Added support for disabling usage of various system APIs at library build time. This can be useful when a certain API is detected as present by the library configuration scripts but must not be used for some reason (for example, when runtime detection does not work on the target system). See the description of <a href="index.htm#Macros">configuration macros</a> for more details.</li>
<li><b>New:</b> Added <code>copy_options::synchronize_data</code> and <code>copy_options::synchronize</code> options for the <code>copy_file</code> operation. These options allow to synchronize the written data and attributes with the permanent storage. These options are expensive in terms of performance, but allow to ensure reliability of the copied data. Note that <code>copy_file</code> performed implicit data synchronization on POSIX systems since Boost.Filesystem 1.74.0. This release adds support for more platforms and disables data synchronization by default while allowing the caller to explicitly request it. (<a href="https://github.com/boostorg/filesystem/issues/186">#186</a>)</li>
<li>Added handling of <code>EINTR</code> error code on POSIX systems for some system calls issued internally. In particular, <code>EINTR</code> could have been ignored on <code>close</code>, which on HP-UX would result in a leaked file descriptor.</li>
<li>In the <code>copy_file</code> implementations based on Linux <code>sendfile</code> and <code>copy_file_range</code> system calls, added handling of error codes indicating that a particular filesystem does not support the system call and fall back to the generic <code>read</code>/<code>write</code> loop. This should fix <code>copy_file</code> failing on <a href="https://www.ecryptfs.org/">eCryptFS</a> and possibly other filesystems. (<a href="https://github.com/boostorg/filesystem/issues/184">#184</a>)</li>
<li>The <code>copy_file_range</code> system call is now used since Linux kernel 4.5, whereas previously it was only enabled since 5.3. The <code>copy_file</code> implementation will fall back to <code>sendfile</code> or <code>read</code>/<code>write</code> loop if <code>copy_file_range</code> fails to copy a given file across filesystems.</li>
<li>The <code>copy_file</code> implementations based on Linux <code>sendfile</code> and <code>copy_file_range</code> system calls will not be used on filesystems that are known to contain files with generated content. These system calls are incompatible with such files, and copying them would result in zero-sized files. The generic <code>read</code>/<code>write</code> loop will be used instead. Currently, the blacklisted filesystems are: procfs, sysfs, tracefs and debugfs.</li>
<li>In the <code>copy_file</code> implementation based on <code>read</code>/<code>write</code> loop, increased the maximum size of the buffer used for temporary storage and take into account the target filesystem block size for more optimal performance.</li>
<li>On Windows CE, calling <code>current_path</code> to obtain the current path for a process will now fail with an error instead of returning successfully with a root path. This platform does not support current directory. Changing the current path was already failing similarly in previous releases of Boost.Filesystem.</li>
<li>In <code>canonical</code>, fixed the check for a symlink referencing a directory above root, if an earlier symlink was resolved to an absolute path with a different root from the original path.</li>
<li>In <code>canonical</code>, added a limit for the maximum number of symlinks that can be resolved during the call. The limit is currently at least 40 symlinks.</li>
<li>On Windows, <code>canonical</code> and <code>weakly_canonical</code> will now use <code>path::preferred_separator</code> for the root directory separator in the resulting paths. This fixes "file not found" errors caused by Windows API not handling generic separators in UNC paths and paths that start with the Win32 filesystem prefix ("\\?\"). (<a href="https://github.com/boostorg/filesystem/issues/87">#87</a>, <a href="https://github.com/boostorg/filesystem/issues/187">#187</a>)</li>
<li><b>New:</b> Added <code>weakly_canonical</code> overloads taking <code>base</code> path as an argument.</li>
<li>On Windows, <code>weakly_canonical</code> no longer fails with an error if the input path contains elements that do not exist in the filesystem but are cancelled by a subsequent dot-dot ("..") element. For example, <code>weakly_canonical("C:\\a\\..")</code> would previously fail if "C:\a" directory did not exist. (<a href="https://github.com/boostorg/filesystem/issues/201">#201</a>)</li>
<li>In <code>read_symlink</code> on Windows, corrected reparse point handling. The operation would return an empty path for some mount points (for example, created by <a href="https://www.box.com/">Box</a> cloud storage driver) and directory junction points that had empty print names. The new implementation now parses substitute name of the reparse point and attempts to reconstruct a Win32 path from it. (<a href="https://github.com/boostorg/filesystem/issues/187">#187</a>)</li>
<li>On Windows, file streams provided in <code>boost/filesystem/fstream.hpp</code> will use wide character paths on libc++ versions 7.0 and higher, when the standard library supports opening files with wide character paths. (<a href="https://github.com/boostorg/filesystem/issues/181">#181</a>)</li>
<li>On Windows, creating symlinks should no longer require elevated privileges, if Windows is configured in <a href="https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development">Developer mode</a>.</li>
<li>With some compilers, global objects used internally in Boost.Filesystem are now destroyed after user's global destructors are called. This allows to call Boost.Filesystem methods during the program termination stage. In particular, this concerns the path locale that is used for character code conversion and can be installed by calling <code>path::imbue</code>. The supported compilers include MSVC, GCC and Clang, as well as other compilers that support customizing program initialization order through <code>#pragma section</code> (for MSVC-compatible compilers) or <code>__attribute__ ((init_priority))</code> (for GCC-compatible compilers).</li>
</ul>
<h2>1.76.0</h2>
<ul>
<li>Updated compatibility with <a href="https://wasi.dev/">WASI</a> platform. (<a href="https://github.com/boostorg/filesystem/pull/169">PR#169</a>)</li>
<li>Fixed an exception being thrown by <code>path::remove_filename</code> if the path is "////". (<a href="https://github.com/boostorg/filesystem/issues/176">#176</a>)</li>
<li>Fixed <code>create_directories</code> disregarding errors from file status query operations issued internally. This could result in incorrect error codes returned by <code>create_directories</code>. (<a href="https://github.com/boostorg/filesystem/issues/182">#182</a>)</li>
</ul>
<h2>1.75.0</h2>
<ul>
<li><b>New:</b> Added <code>creation_time</code> operation, which allows to obtain file creation time. (Inspired by <a href="https://github.com/boostorg/filesystem/pull/134">PR#134</a>)</li>
<li>The returned value of <code>last_write_time(p, ec)</code> operation in case of failure has been changed to a minimal value representable by <code>std::time_t</code> instead of -1.</li>
<li>The returned value of <code>hard_link_count(p, ec)</code> operation in case of failure has been changed to <code>static_cast&lt;uintmax_t&gt;(-1)</code> instead of 0.</li>
<li>On POSIX systems, <code>file_size</code> will now indicate error code <code>errc::function_not_supported</code> if the path resolves to a non-regular file. Previously, <code>errc::operation_not_permitted</code> was reported.</li>
<li>On Linux, many operations now use <code>statx</code> system call internally, when possible, which allows to reduce the amount of information queried from the filesystem and potentially improve performance. The <code>statx</code> system call was introduced in Linux kernel 4.11.</li>
<li>Removed <code>const</code>-qualification from return types of some <code>path</code> methods. This could prevent move construction and move assignment at the call site in some cases. (<a href="https://github.com/boostorg/filesystem/issues/160">#160</a>)</li>
<li>On OpenBSD 4.4 and newer, use <code>statvfs</code> system call to obtain filesystem space information. (Inspired by <a href="https://github.com/boostorg/filesystem/pull/162">PR#162</a>)</li>
<li>On Windows, <code>space</code> now returns with an error if the provided path does not idendify an existing file. (<a href="https://github.com/boostorg/filesystem/issues/167">#167</a>)</li>
</ul>
<h2>1.74.0</h2>
<ul>
<li>Removed compile-time checks for support for symlinks and hardlink on Windows. Instead, a runtime check is used. (<a href="https://github.com/boostorg/filesystem/pull/142">PR#142</a>)</li>
<li>Fixed handling of reparse points in <code>canonical</code> and <code>read_symlink</code> on Windows. This also affects other algorithms that involve <code>canonical</code> and <code>read_symlink</code> in their implementation. (<a href="https://github.com/boostorg/filesystem/pull/100">PR#100</a>, <a href="https://github.com/boostorg/filesystem/issues/85">#85</a>, <a href="https://github.com/boostorg/filesystem/issues/99">#99</a>, <a href="https://github.com/boostorg/filesystem/issues/123">#123</a>, <a href="https://github.com/boostorg/filesystem/issues/125">#125</a>)</li>
<li>Fixed that <code>read_symlink</code> on Windows could potentially fail or cause failures elsewhere with a sharing violation error, if the same symlink was opened concurrently. (<a href="https://github.com/boostorg/filesystem/issues/138">#138</a>)</li>
<li>Fixed that <code>is_symlink(directory_entry)</code> would always return <code>false</code>, even if the directory entry actually referred to a symlink. (<a href="https://github.com/boostorg/filesystem/pull/148">PR#148</a>)</li>
<li>Added missing status inspection operation overloads for <code>directory_entry</code> and <code>error_code</code> (e.g. <code>is_directory(directory_entry, error_code&amp;)</code>). Removed incorrect <code>noexcept</code> specifications for the overloads not taking the <code>error_code</code> arguments.</li>
<li><code>copy_file</code> implementation has been updated to perform checks on the source and target files, as required by C++20 ([fs.op.copy.file]/4.1). In particular, the operation will fail if the source or target file is not a regular file or the source and target paths identify the same file.</li>
<li><code>copy_file</code> on POSIX systems will now also copy the source file permissions to the target file, if the target file is overwritten.</li>
<li><b>New:</b> Added <code>copy_file</code> implementations based on <code>sendfile</code> and <code>copy_file_range</code> system calls on Linux, which may improve file copying performance, especially on network filesystems.</li>
<li><b>Deprecated:</b> The <code>copy_option</code> enumeration that is used with the <code>copy_file</code> operation is deprecated. As a replacement, the new enum <code>copy_options</code> (note the trailing 's') has been added. The new enum contains values similar to the <code>copy_options</code> enum from C++20. The old enum values are mapped onto the new enum. The old enum will be removed in a future release.</li>
<li><b>New:</b> Added <code>copy_options::skip_existing</code> option, which allows <code>copy_file</code> operation to succeed without overwriting the target file, if it exists.</li>
<li><b>New:</b> Added <code>copy_options::update_existing</code> option, which allows <code>copy_file</code> operation to conditionally overwrite the target file, if it exists, if its last write time is older than that of the replacement file.</li>
<li><b>New:</b> <code>copy_file</code> now returns <code>bool</code>, which indicates whether the file was copied.</li>
<li><b>New, breaking change:</b> <code>copy</code> operation has been extended and reworked to implement behavior specified in C++20 [fs.op.copy]. This includes support for <code>copy_options::recursive</code>, <code>copy_options::copy_symlinks</code>, <code>copy_options::skip_symlinks</code>, <code>copy_options::directories_only</code>, <code>copy_options::create_symlinks</code> and <code>copy_options::create_hard_links</code> options. The operation performs additional checks based on the specified options. Applying <code>copy</code> to a directory with default <code>copy_options</code> will now also copy files residing in that directory (but not nested directories or files in those directories).</li>
<li><b>New:</b> Added <code>create_directory</code> overload taking two paths. The second path is a path to an existing directory, which is used as a source of permission attributes to use in the directory to create.</li>
<li><b>Deprecated:</b> <code>copy_directory</code> operation has been deprecated in favor of the new <code>create_directory</code> overload. Note that the two operations have reversed order of the path arguments.</li>
<li><code>equivalent</code> on POSIX systems now returns the actual error code from the OS if one of the paths does not resolve to a file. Previously the function would return an error code of 1. (<a href="https://github.com/boostorg/filesystem/issues/141">#141</a>)</li>
<li><code>equivalent</code> no longer considers file size and last modification time in order to test whether the two paths refer to the same file. These checks could result in a false negative if the file was modified during the <code>equivalent</code> call.</li>
<li><b>New:</b> Added <code>absolute</code> overloads taking <code>error_code</code> argument.</li>
<li>Operations that have <code>current_path()</code> as the default value of their arguments and also have an <code>error_code</code> argument will use the <code>current_path(error_code& ec)</code> overload to obtain the current path, so that its failure is reported via the <code>error_code</code> argument instead of an exception.</li>
<li><code>space</code> now initializes the <code>space_info</code> structure members to -1 values on error, as required by C++20 ([fs.op.space]/1).</li>
<li><code>space</code> on Windows now accepts paths referring to arbitrary files, not only directories. This is similar to POSIX systems and corresponds to the operation description in C++20. (<a href="https://github.com/boostorg/filesystem/issues/73">#73</a>)</li>
<li><b>New:</b> Added implementation of <code>temp_directory_path</code> for Windows CE. (<a href="https://github.com/boostorg/filesystem/pull/25">PR#25</a>)</li>
<li><b>New:</b> Improved compatibility with <a href="https://wasi.dev/">WASI</a> platform. (<a href="https://github.com/boostorg/filesystem/pull/144">PR#144</a>)</li>
<li><b>New:</b> Improved support for Embarcadero compilers. (<a href="https://github.com/boostorg/filesystem/pull/130">PR#130</a>)</li>
<li><b>New:</b> Added implementations of <code>unique_path</code> operation based on <code>getrandom</code> (Linux), <code>arc4random_buf</code> (OpenBSD/FreeBSD/CloudABI) and BCrypt (Windows) system APIs.</li>
<li><b>Deprecated:</b> Auto-linking against system libraries on Windows with MSVC-compatible compilers is deprecated and will be removed in a future release. This affects users linking against static library of Boost.Filesystem. Users are advised to update their project build systems to either use a shared library of Boost.Filesystem, or explicitly specify the dependencies of Boost.Filesystem in the linker command line. In the future, the dependency information may also be exposed through CMake config files.</li>
</ul>
<h2>1.72.0</h2>
<ul>
<li>Extracted <code>filesystem_error</code> to <code>exception.hpp</code>; <code>file_status</code> and associated enums and functions to <code>file_status.hpp</code>; <code>directory_entry</code>, <code>directory_iterator</code> and <code>recursive_directory_iterator</code> to <code>directory.hpp</code>.</li>
<li><b>Deprecated:</b> For backward compatibility <code>operations.hpp</code> still includes the new headers <code>exception.hpp</code>, <code>file_status.hpp</code> and <code>directory.hpp</code>, unless <code>BOOST_FILESYSTEM_NO_DEPRECATED</code> macro is defined. These implicit includes are considered deprecated and will be removed in a future release. Users are encouraged to include the new headers directly or include <code>filesystem.hpp</code>.</li>
<li>The <code>filesystem_error</code> exception is now implemented in the compiled library of Boost.Filesystem. Users may need to add linking with Boost.Filesystem library in their projects.</li>
<li>On POSIX.1-2008 platforms, use <code>utimensat</code> instead of <code>utime</code>. <code>utime</code> is declared obsolete in POSIX.1-2008 and can be disabled e.g. in uClibc-ng. (<a href="https://github.com/boostorg/filesystem/pull/115">PR#115</a>)</li>
<li><code>directory_iterator</code> is now left in the end state on memory allocation errors.</li>
<li>In <code>directory_iterator</code> on POSIX systems, support for <code>readdir</code>/<code>readdir_r</code> has been reworked to avoid memory allocations for <code>dirent</code> structures when <code>readdir</code> is used. This reduces memory consumption and eliminates the possibility of buffer overruns in case if <code>readdir</code> produces a very long directory name.</li>
<li>On Windows, use Boost.WinAPI to select the target Windows version.</li>
<li><b>New:</b> Added <code>directory_options</code> enum, which reflects the same named enum from C++20. The enum is supported in <code>directory_iterator</code> and <code>recursive_directory_iterator</code> to customize iteration behavior. In particular, the iterators now support skipping directories that can&apos;t be opened due to insufficient permissions. The <code>symlink_option</code> enum is now deprecated and should be replaced with <code>directory_options</code>.</li>
<li>By default, <code>recursive_directory_iterator</code> is now reset to the end state in case of errors, as required by C++20. (<a href="https://github.com/boostorg/filesystem/issues/112">#112</a>)</li>
<li><b>New:</b> Added <code>directory_options::pop_on_error</code> option, which configures <code>recursive_directory_iterator</code> so that it attempts to recover from iteration errors by repeatedly invoking <code>pop()</code> until it succeeds or the end state is reached. (<a href="https://github.com/boostorg/filesystem/issues/113">#113</a>)</li>
<li><b>New:</b> Added <code>directory_options::skip_dangling_symlinks</code> option, which configures <code>recursive_directory_iterator</code> so that it doesn't follow dangling directory symlinks and continues iteration instead of reporting an error.</li>
<li><b>Deprecated:</b> The following members of <code>recursive_directory_iterator</code> are now marked as deprecated: <code>level()</code>, <code>no_push_pending()</code>, <code>no_push_request()</code>, <code>no_push()</code>. Users are advised to replace their use with the standard counterparts: <code>depth()</code>, <code>recursion_pending()</code>, <code>disable_recursion_pending()</code>. Note that <code>recursion_pending()</code> has the opposite meaning compared to <code>no_push_pending()</code> and <code>no_push_request()</code>. Deprecated methods will be removed in a future release.</li>
<li>Fixed <code>path::lexically_relative</code> (and any dependent algorithms) to correctly handle empty, dot and dot-dot path elements in its argument. The behavior is made closer to C++17 <code>std::path::lexically_relative</code> in that empty and dot path elements are ignored and dot-dot path elements are accounted by decreasing the number of dot-dot path elements to generate in the resulting relative path. (<a href="https://github.com/boostorg/filesystem/issues/76">#76</a>)</li>
</ul>
<h2>1.71.0</h2>
<ul>
<li><b>New:</b> Added minimal support for CMake. (<a href="https://github.com/boostorg/filesystem/pull/106">PR#106</a>)</li>
<li>Fixed incorrect <code>error_code</code> returned from directory iterator increment when <code>readdir_r</code> is used.</li>
<li>For <code>path</code>, fixed rvalue-aware <code>operator/</code> return type to return an rvalue instead of rvalue reference. This fixes leaving a dangling reference in the user&apos;s code if the result of <code>operator/</code> is bound to a const reference. (<a href="https://github.com/boostorg/filesystem/issues/110">#110</a>)</li>
<li>Fixes for better compatibility with Windows CE. (<a href="https://github.com/boostorg/filesystem/pull/24">PR#24</a>)</li>
</ul>
<h2>1.70.0</h2>
<ul>
<li><b>New:</b> Added support for movability to directory iterators.</li>
<li><b>New:</b> Added file status query overloads for directory_entry. This avoids a relatively expensive OS query when file status is requested for a result of dereferencing a directory iterator. (<a href="https://github.com/boostorg/filesystem/pull/55">PR#55</a>)</li>
<li>Fixed a few instances of dereferencing <code>std::string::end()</code> in path implementation.</li>
<li>Fixed program termination in case of out of memory condition in directory iterators constructors and operations accepting a reference to <code>error_code</code>. (<a href="https://github.com/boostorg/filesystem/issues/58">#58</a>)</li>
<li>Fixed possible linking errors caused by missing definitions of static members of <code>path</code>. (<a href="https://svn.boost.org/trac/boost/ticket/12759">#12759</a>)</li>
<li>Fixed possible use of uninitialized data in directory iterator increment operation on Linux. (<a href="https://github.com/boostorg/filesystem/issues/97">#97</a>)</li>
<li>Reworked <code>current_path</code> and <code>read_symlink</code> implementation to avoid possible memory exhaustion on broken or tampered with filesystems. The functions now have an internal limit of the path size they will accept from the OS, which is currently 16 MiB.</li>
<li>Increased the size of the internal buffer used by <code>copy_file</code>.</li>
</ul>
<h2>1.69.0</h2>
<ul>
<li>Don&apos;t use <code>readdir_r</code> on Linux and Android since the <code>readdir</code> function is already thread-safe. (<a href="https://github.com/boostorg/filesystem/pull/68">PR#68</a>,
<a href="https://github.com/boostorg/filesystem/issues/72/">#72</a>)</li>
<li>Fixed crashes in <code>boost::filesystem::copy</code> due to undefined behavior in the implementation. (<a href="https://github.com/boostorg/filesystem/pull/71">PR#71</a>)</li>
<li>Fixed undefined behavior in <code>boost::filesystem::directory_iterator</code> implementation. (<a href="https://github.com/boostorg/filesystem/pull/77">PR#77</a>)</li>
<li>Fixed compilation errors when using directory iterators with <code>BOOST_FOREACH</code>.</li>
<li>Removed workarounds for older PGI C++ compiler versions to fix compilation on the newer ones. (<a href="https://github.com/boostorg/filesystem/pull/49">PR#49</a>)</li>
<li>Fixed MSVC warnings about narrowing conversions. (<a href="https://github.com/boostorg/filesystem/pull/44">PR#44</a>)</li>
</ul>
<h2>1.67.0</h2>
<ul>
<li>Fix static initialization issue that caused a crash if path operations were used before main(). (<a href="https://github.com/boostorg/filesystem/pull/62">PR#62</a>,
<a href="https://github.com/boostorg/filesystem/pull/43">PR#43</a>, <a href="https://github.com/boostorg/filesystem/pull/50">PR#50</a>, <a href="https://github.com/boostorg/filesystem/pull/59">PR#59</a>)</li>
</ul>
<h2>1.66.0</h2>
<ul>
<li>Clean up some tutorial example code and fix the wording for it in the
tutorial. Thanks to Anmol-Singh-Jaggi for pull request <a href="https://github.com/boostorg/filesystem/pull/11">#11</a>.</li>
</ul>
<h2>1.64.0</h2>
<ul>
<li><code>is_empty()</code>overload with <code>error_code</code> parameter
should not throw on error. Thanks to ldqrk for pull request #42</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/10731">#10731</a> and
<a href="https://svn.boost.org/trac/boost/ticket/9480">#9480</a>, <i>Evaluate
path.extension only once</i>. Thanks to Daniel Krügler for pull request #41.</li>
<li>Fix error propagation in <code>space(p, ec)</code>. Thanks to cmuellner
for pull request #39.</li>
<li>Add test/config_info.cpp to increase macro state reporting in hopes of
easing debugging on remote machines.</li>
<li>Fix <code>operations_test</code> failure on MinGW: MinGW defines
__MINGW32__ rather than _MSC_VER, so also test for __MINGW32__ to see if
setenv/unsetenv workaround needed.</li>
</ul>
<h2>1.63.0</h2>
<ul>
<li dir="ltr">
<p dir="ltr"><b>Deprecated <code>generic()</code> function name</b>: The undocumented experimental class
<code>path</code> member function <code>generic()</code> has been renamed <code>
generic_path()</code>. Fixes
<a href="https://svn.boost.org/trac/boost/ticket/11855">#11855</a>, <i>generic
gives problems in C++/CLI.</i> Unless the macro BOOST_FILESYSTEM_NO_DEPRECATED
is defined, the original <code>generic()</code> will continue to be supplied
as a workaround for existing user code. But <code>generic()</code>is
deprecated. User code should migrate to the new name.</li>
<li><b>New:</b> Class <code>path</code> adds constexpr constants <code>
separator</code> and <code>dot</code> of the type appropriate for the
platform, and adds query functions <a href="reference.html#filename_is_dot">
<code>filename_is_do</code>t</a> and <code>
<a href="reference.html#filename_is_dot­_dot">filename_is_dot_dot</a></code>.
These add convenience and the implementations may be more efficient that user
coded equivalent functions.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/12578">#12578</a>, <i>
Make directory iterators able to detect when a copy has advanced to the end</i>.
This bug in <code>directory_iterator</code> and <code>
recursive_directory_iterator</code> equality testing has existed more than a
dozen years. Nowadays test driven development would likely have detected the
problem in early development. Sigh.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/12495">#12495</a>, <i>
<code>create_directories()</code> crashes when passed empty string as path</i>,
from Samantha Ritter. Also affected <code>create_directory()</code>. Charles
Olivi submitted a pull request with some particularly helpful test cases.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/7307">#7307</a>, <i>
remove_all(dirname,ec) throws on write protected directories.</i> This is a
tough one to test. There are three internal function calls where errors might
arise, and it would take too much time to write tests for each of those cases.
Someday we will have Titus Winter&#39;s mock installable file system, but for now
are relying on code inspection rather than testing.</li>
<li>Fix a cygwin warning and a cygwin error. Thanks to thtrummer for pull
request #30.</li>
<li>Fixed two broken links in reference docs. Thanks to tbeu for pull
request #34.</li>
<li>Fix reference doc signatures for <code>path</code> stem(), extension()
member functions. Thanks to faithandbrave for pull request #31</li>
<li>Fix broken link to <a href="https://svn.boost.org/trac/boost/ticket/7506">#7506</a> in 1.60.0 Release History (Daniel Krügler).</li>
<li>Refactor <code>push_directory()</code>internal logic so it is easier to
reason about.</li>
</ul>
<h2>1.60.0</h2>
<ul>
<li dir="ltr">
<p dir="ltr"><b>New:</b> Added functions <code>
<a href="reference.html#lex-normal">lexically_normal</a></code>, <code>
<a href="reference.html#lex-relative">lexically_relative</a></code>, <code>
<a href="reference.html#relative">relative</a></code>, and <code>
<a href="reference.html#weakly_canonical">weakly_canonical</a></code>. Many thanks to Jamie Allsop for his help and
perseverance. Resolves tickets
<a href="https://svn.boost.org/trac/boost/ticket/1976">#1976</a>,
<a href="https://svn.boost.org/trac/boost/ticket/5897">#5897</a>,
<a href="https://svn.boost.org/trac/boost/ticket/6249">#6249</a></li>
<li><b>New:</b> Class <code>path</code> now has
<a href="reference.html#path-iterators"> <code>reverse_iterator</code>,
<code>const_reverse_iterator</code>, <code>rbegin()</code>, and <code>rend()</code></a>. </li>
<li><b>New:</b> C++11 <code>noexcept</code> supplied as specified in the
Filesystem TS if supported by the compiler.</li>
<li><b>New:</b> C++11 move constructors and move assignments supplied as
specified in the Filesystem TS if supported by the compiler. Resolves
<a href="https://svn.boost.org/trac/boost/ticket/10291">#10291</a>.</li>
<li><b>New:</b> Existing functions whose names changed in the Filesystem TS
are now supported under both the old and new names.</li>
<li><b>New: </b>Added <code><a href="reference.html#path-size">size</a>()</code>
function to class <code>path</code>. Resolves
<a href="https://svn.boost.org/trac/boost/ticket/6874">#6874</a>, <i>Path
should have a size() member function</i>.</li>
<li>Clear several spurious GCC warnings.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/11733">#11733</a>, <i>
Missing unistd.h include in boost/libs/filesystem/src/unique_path.cpp</i> by
apply a patch from Idar Tollefsen.</li>
<li>Fix a race condition in <code>unique_path</code> by applying
<a href="https://github.com/boostorg/filesystem/pull/15">pull request #15</a>
from Sebastian Redl. Also fixes
<a href="https://svn.boost.org/trac/boost/ticket/7506">#7506</a>, <i><code>unique_path</code> Fails on Windows for Temporary User
Profiles</i>.</li>
<li>Fix bug in <i><code>file_status</code></i> and <i><code>
recursive_directory_iterator</code></i>: C++ turns an explicit constructor
with all arguments except first defaulted into non-explicit single argument
constructor.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/10591">#10591</a>, <i>
boost::filesystem does not build on iOS 8</i>, by applying a patch submitted
by Daniel Seither.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/9454">#9454</a>, <i>
Boost Filesystem [library build] not compiling when
BOOST_FILESYSTEM_NO_DEPRECATED is defined</i>, by applying a patch submitted
by Makesim.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/11447">#11447</a>, <i>
__OpenBSD__ macro name misspelled</i>, by applying a patch submitted by Jasper
Lievisse Adriaanse.</li>
<li>
<p>Fix <a href="https://svn.boost.org/trac/boost/ticket/11288">#11288</a>, <i>
<font face="Arial">A patch to avoid redundant string allocations</font></i>,
by applying a patch submitted by Yevhen Ivannikov.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/11175">#11175</a>,
out-of-date documentation causing users to incorrectly expect that the library
could be used with exceptions disabled.</li>
<li>Resolve <a href="https://svn.boost.org/trac/boost/ticket/11175">#11166</a>
by mitigating (i.e. reducing the likelihood of) a possible external file
system race in <code>remove()</code>.</li>
<li>
<p>Fix <a href="https://svn.boost.org/trac/boost/ticket/7258">#7258</a>,
<i><code>create_directories</code> returns false if the path ends with a slash</i>.
Also fix related issues if path contains <i>dot</i> or <i>dot-dot</i>
elements, and added test cases to the test suite.</li>
<li>
<p>Reference docs editorial cleanups: Use same style sheet as the
rest of the documentation. Tweak tab font size. Fix excessively long lines in
tables, synopsis.</li>
<li>Resolve <a href="https://svn.boost.org/trac/boost/ticket/10766">
#10766</a>, <i>parent_path() with redundant separator returns wrong value</i>,
by adding examples and notes to the reference documentation to show why the
returned value is in fact correct, and to provide rationale for that behavior.
See <a href="reference.html#path-iterators">[path.itr]</a>, and
<a href="reference.html#path-decomposition">[path.decompose]</a> <code>
parent_path()</code> and <code>filename()</code> sections of the reference
docs.</li>
<li>Minor other fixes, including pull requests from Jonathan Wakely and Marcel
Raad.</li>
<li>Closed several tickets as duplicates or otherwise resolved by the
above changes:<ul>
<li><a href="https://svn.boost.org/trac/boost/ticket/7607">#7607</a>, <i>path
should not infer an invisible &quot;.&quot; at the end of a path that ends with a slash;
</i><a href="https://svn.boost.org/trac/boost/ticket/7258">#7258</a>,
<a href="https://svn.boost.org/trac/boost/ticket/10766">#10766</a></li>
<li><a href="https://svn.boost.org/trac/boost/ticket/11061">#11061</a>,
<a href="https://svn.boost.org/trac/boost/ticket/11062">#11062</a>, <i>
impossible to traverse the path of the reverse iterator</i>, is effectively
resolved by the addition of the class <code>path</code> reverse iteration
feature. The reference documentation has also been updated with
<a href="reference.html#path-iterators">a note</a> warning about the
limitations of class <code>path</code> iterators.</li>
</ul>
</li>
</ul>
<h2>1.59.0</h2>
<ul>
<li>Update the Tutorial:<ul>
<li>Use C++11 in the example programs to improve clarity.</li>
<li>Update the example source code show to match the actual example source
code in the cpp files.</li>
<li>Rerun all the examples and update the output shown in the tutorial
accordingly.</li>
<li>Fix spacing and other HTML presentation issues.</li>
</ul>
</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/11491">#11491</a>, <i>
<code>temp_directory_path()</code> doesn&#39;t return valid temp path on Android</i>.</li>
</ul>
<h2>1.58.0</h2>
<ul>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/6124">#6124</a>,
<a href="https://svn.boost.org/trac/boost/ticket/6779">#6779</a>, and
<a href="https://svn.boost.org/trac/boost/ticket/10038">#10038</a>. Cannot
pass a BOOST_SCOPED_ENUM to a compiled function because it will result in an
undefined reference if the library is compiled with -std=c++0x but the use is
compiled in C++03 mode, or visa versa.</li>
<li>Rewrite Windows implementation of <code>temp_directory_path()</code> to (1) avoid
<code>GetTempPath()</code> failure if path length &gt; 130 (ticket #5300) and (2) provide a
more sensible sequence of directories than provided by <code>GetTempPath()</code>, per
boost list discussion &quot;[filesystem] temp_directory_path() behavior on
Windows&quot;. The new sequence is:<ol>
<li><i><code>%TMP%</code></i></li>
<li><i><code>%TEMP%</code></i></li>
<li><code><i>%LOCALAPPDATA%</i>/Temp</code></li>
<li><code><i>%USERPROFILE%</i>/Temp</code></li>
<li><code><i>GetWindowsDirectoryW()</i>/Temp</code></li>
</ol>
</li>
</ul>
<h2>1.57.0</h2>
<ul>
<li>Rework class <code>path</code> locale and codecvt implementation for increased reliability.
This change was SVN revision 83021, which should have gone into 1.56.0 but
unfortunately the merge didn't happen until too late.</li>
<li>Fix tickets <a href="https://svn.boost.org/trac/boost/ticket/8930">#8930</a>, <a href="https://svn.boost.org/trac/boost/ticket/9054">#9054</a>,
<a href="https://svn.boost.org/trac/boost/ticket/9214">#9219</a>,
<a href="https://svn.boost.org/trac/boost/ticket/10228">#10228</a>, and
<a href="https://svn.boost.org/trac/boost/ticket/10641">#10641</a>, all
related to locales and codecvt facets.</li>
<li>The net effect of the above changes and fixes should be to eliminate
spurious &quot;locale::facet::_S_create_c_locale name not valid&quot; errors on Linux
and other non-BSD POSIX-like systems. The error will continue to occur, as it
should, when a path encoding conversion char-to-wchar_t or wchar_t-to-char is
attempted in an environment without a valid C locale (for example, if the LANG
environment variable is invalid or not defined).</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/6124">#6124</a>,
<a href="https://svn.boost.org/trac/boost/ticket/6779">#6779</a>, and
<a href="https://svn.boost.org/trac/boost/ticket/10038">#10038</a> - an
undefined reference that occurred when the library was compiled for C++03 but
the using program was compiled for C++11, or vice versa. The private library
interface has been changed to use a plain-old C++03 enum. This is the fix
suggested by Andy in 6779.</li>
<li>The Windows implementation now treats NTFS directory junctions (also known
as junctions, also known as mount points) as symlinks. This has the effect of
treating directory junctions as directories, and thus supporting all
operations suitable for directories. This resolves
<a href="https://svn.boost.org/trac/boost/ticket/9016">#9016</a>. Directory
junctions are very similar to symlinks, but may have performance or other
advantages in some situations. They can be created from the command line with
&quot;<code>mklink /j link target</code>&quot;. There is no plan for Boost.Filesystem to
be able to create them directly other than by calling <code>std::system()</code>.</li>
</ul>
<h2>1.56.0</h2>
<ul>
<li>Reorganize <code>recursive_directory_iterator::increment</code>, adding an
invariant that progress is always made, even if an error is reported by
exception or error_code. Add a manually executed test, <code>
test/issues/recurse_dir_iter_5403.cpp</code>. Adjust regular regression tests
as needed. Thanks to Claudio Bley for the
<a href="https://github.com/boostorg/filesystem/pull/4">pull request</a> - the
change was incorporated into the reorganized code. Fixes
<a href="https://svn.boost.org/trac/boost/ticket/5403">#5403</a> and
<a href="https://svn.boost.org/trac/boost/ticket/6821">#6821</a>.</li>
<li>Fix <code>canonical()</code> to treat parent of root as root. (Christian
Hammerl) Fixes <a href="https://svn.boost.org/trac/boost/ticket/9683">#9683</a>
and <a href="https://svn.boost.org/trac/boost/ticket/10187">#10187</a>.</li>
<li>Added missing test for <code>__sun</code> macro which is defined on
Solaris 10. (Chris Stylianou)</li>
<li>Minor fixes and code cleanup.</li>
<li>Update IDE projects to Visual Studio 2013.</li>
<li>Remove unused <code>const char colon</code> to clear clang warning. (J?gen
Hunold)</li>
<li>Add BOOST_NOEXCEPT to <code>class filesystem_error</code>.</li>
<li>Change <code>perms::all_all</code> and <code>perms::perms_mask</code> to
absolute values to quiet intellisense warnings, and conform to C++11.</li>
</ul>
<h2>1.54.0</h2>
<ul>
<li>Reimplement <code>path::codecvt()</code> and <code>path::imbue()</code>
with portable code that is intended to be much more robust and maintainable. A
section on <a href="reference.html#path-Usage">path usage concerns</a> has
been added to the reference documentation describing several concerns that
arise in the context of multithreading and <code>path::codecvt()</code>.</li>
</ul>
<h2>1.52.0</h2>
<ul>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/7239">#7239</a>, <i>Stack
overflow when calling <code>create_directories(&quot;:D&quot;)</code></i>. The reported
problem was a symptom of an internal bug that caused <code>path::filename()</code>
and <code>path::parent_path()</code> to fail on Windows for <code>path(&quot;:&quot;)</code>,
and that in turn caused other functions that depend on <code>filename()</code>
or <code>parent_path()</code> to fail, such as <code>create_directories()</code>.</li>
</ul>
<h2>1.51.0</h2>
<ul>
<li>Add begin() and end() non-member functions for directory_iterator and
recursive_directory_iterator so that C++11 range-based for statements work.
Suggested by feature requests
<a href="https://svn.boost.org/trac/boost/ticket/5896">#5896</a> and
<a href="https://svn.boost.org/trac/boost/ticket/6521">#6521</a>, using the
<a href="https://svn.boost.org/trac/boost/ticket/5896">#5896</a> approach.</li>
<li>Add range_begin() and range_end() non-member functions for directory_iterator and
recursive_directory_iterator so that
<a href="http://www.boost.org/libs/foreach/">BOOST_FOREACH</a> works.</li>
<li>Fix a Linux fchmodat problem affecting symlink permissions reported during
discussion of <a href="https://svn.boost.org/trac/boost/ticket/6659">#6659</a>.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/6659">#6659</a> and
<a href="https://svn.boost.org/trac/boost/ticket/7051">#7051</a>, <i>fchmodat
supported only on Solaris 11</i>. Fix for both Sun and GCC compilers. </li>
</ul>
<h2>1.50.0</h2>
<ul>
<li>Remove Filesystem Version 2 from the distribution. Version 3 is now the
only distributed version. Those still using V2 are urged to migrate to V3 as
soon as possible.</li>
<li>Add <code>constexpr value_type preferred_separator</code> to class path.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5118">#5118</a>, <i>
<code>replace_extension</code> doesn't work as specified in documentation</i>. The
documentation, implementation, and test cases have all had fixes applied. The
documentation had failed to mention that any existing extension is removed.
The behavior for simple cases has been reverted to the Version 2 behavior, but
with corrections so that complex replacements now work. Two test cases from
#5118 have been added.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/3737">#3737</a>,
<i>Boost.Filesystem does not compile on Windows Mobile</i>. On Windows, &lt;sys/stat.h&gt;
is no longer included.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/4065">#4065</a>,
<i>Boost Filesystem lexicographic path comparison inconsistent</i>. This required
multiple source code bug fixes and code cleanup, correcting problems not
related to lexicographical issues.</li>
<li>Add class path member function <code>compare</code> for consistency with
std::string.</li>
<li>Tighten BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK logic
in filesystem/config.hpp so that one or the other is always defined, and both
being defined is a #error.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6690">#6690</a> and
<a href="http://svn.boost.org/trac/boost/ticket/6737">#6737</a>, resolving
static linking related problems with VC++ 8 through 11. Note that this fix may
reintroduce codecvt thread safety problems
<a href="http://svn.boost.org/trac/boost/ticket/4889">#4889</a>,
<a href="http://svn.boost.org/trac/boost/ticket/6320">#6320</a>, for these
compilers if static linking is used.</li>
<li>Add path::operator+= and concat functions to tack on things like suffixes
or numbers. Suggested by Ed Smith-Rowland and others.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6809">#6809</a>,
<i>Implementation of filesystem::rename() method for MS Windows is wrong</i>, by
adding MOVEFILE_COPY_ALLOWED to deal with renames across drives, volumes, file
systems. Fix has no effect on non-Windows systems.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6819">#6819</a>, A path operand with a source that was a one character array was
treated as empty, even if it wasn't empty. Such arrays can occur in unions or
in code using C variable length array idioms.</li>
<li>Fix <a href="http://svn.boost.org/trac/boost/ticket/6932">#6932</a>,
<i>create_directories throws exception even if error_code is specified</i>.</li>
</ul>
<h2>1.49.0</h2>
<ul>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/3714">#3714</a>,
Added test cases and fixes for class path errors when assignment or append
used self or portion of self as source. </li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/4889">#4889</a>,
<a href="https://svn.boost.org/trac/boost/ticket/6320">#6320</a>, <i>Locale codecvt_facet not thread safe on Windows</i>. Move
Windows, Mac OS X, locale and codecvt facet back to namespace scope. POSIX
except OS X uses local static initialization (IE lazy) to ensure exceptions
are catchable if environmental variables are misconfigured and to avoid use of
locale(&quot;&quot;) if not actually used.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5652">#5652</a>,
<i>recursive_directory_iterator fails on cyclic symbolic links</i>. Thanks to Daniel Aarno for the patch.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5653">#5653</a>,
<i>recursive_directory_iterator(error_code) can still throw filesystem_error</i>.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900">#5900</a>, <i>directory_iterator
access violation on Windows if error is thrown</i>. Thanks to Andreas Eckleder for the patch.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900#comment:2">#5900
comment 2</a>, a bug in director_iterator construction with error_code argument that
caused increment to be called without the ec argument being passed.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900">#5989</a> by cleaning up test suite path_test.cpp code even
though the ticket itself was not a defect, and clarifying docs; iteration over a path yields
generic format.</li>
<li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5592">#5592</a>, <i>Change Windows codecvt processing from CP_THREAD_ACP to CP_ACP</i>.</li>
<li>Operations function fixes for PGI compiler, thanks to Noel Belcourt.</li>
<li>Relax permissions test to reflect reality, particularly on the Sandia test
platforms.</li>
</ul>
<h2>1.48.0</h2>
<ul>
<li>Added operational function <a href="reference.html#canonical">canonical()</a>,
suggested by David Svoboda, who also provided pseudo-code.</li>
<li>Added <a href="reference.html#hash_value">hash_value()</a> function for
paths. (Daniel James)</li>
<li>Fix path inserter problem (<a href="https://svn.boost.org/trac/boost/ticket/5764">#5764</a>)
reported for QNX6.3.2 host (gcc-3.3.5)</li>
<li>Fix problem of locale(&quot;&quot;) exception being thrown before main() starts on
poorly configured (e.g. LANG=&quot;bad name&quot;) POSIX systems. Resolves the most
serious aspect of tickets
<a href="https://svn.boost.org/trac/boost/ticket/4688">#4688</a>,
<a href="https://svn.boost.org/trac/boost/ticket/5100">#5100</a>,
<a href="https://svn.boost.org/trac/boost/ticket/5289">#5289</a>.</li>
</ul>
<h2>1.47.0</h2>
<ul>
<li>Program file_status.cpp added (V3). See boost-root/libs/filesystem/v3/example.
Useful both as an example and to explore how Boost.Filesystem treats various
status errors.&nbsp; Run &quot;bjam&quot; (NOT &quot;bjam install&quot;) in the example directory
to install in example/bin.</li>
</ul>
<h2>1.46.1</h2>
<ul>
<li>Fix fstream problem for STLPort masquerading as Dinkumware (<a href="https://svn.boost.org/trac/boost/ticket/5217">#5217</a>).</li>
</ul>
<h2>1.46.0</h2>
<ul>
<li>Version 3 of the library is now the default.</li>
<li>IBM vacpp: Workaround for compiler bug affecting iterator_facade. (<a href="https://svn.boost.org/trac/boost/ticket/4912">#4912</a>)</li>
<li>Verify, clarify, document that &lt;boost/config/user.hpp&gt; can be used to
specify BOOST_FILESYSTEM_VERSION. (<a href="https://svn.boost.org/trac/boost/ticket/4891">#4891</a>)</li>
<li>Replaced C-style assert with BOOST_ASSERT.</li>
<li>Undeprecated unique_path(). Instead, add a note mentioning the workaround
for lack of thread safety and possible change to cwd. unique_path() is just
too convenient to deprecate!</li>
<li>Cleared several GCC warnings.</li>
<li>Changed V2 code to use BOOST_THROW_EXCEPTION.</li>
<li>Windows: Fix status() to report non-symlink reparse point correctly.</li>
<li>Add <code>symlink_option</code> to <code>recursive_directory_iterator</code>,
allowing control over recursion into directory symlinks. Note that the default
is changed to not recurse into directory symlinks.</li>
<li><a href="reference.html">Reference</a> documentation cleanup, including
fixing missing and broken links, and adding missing functions.</li>
<li>Miscellaneous implementation code cleanup. </li>
</ul>
<hr>
<p>&copy; Copyright Beman Dawes, 2011</p>
<p>&copy; Copyright Andrey Semashev, 2019-2021</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,18 @@
body
{
font-family: arial, sans-serif;
max-width: 90%;
margin: 0px auto;
}
ins {background-color: #CCFFCC; text-decoration: none;}
del {background-color: #FFCACA; text-decoration: none;}
pre {background-color: #D7EEFF; font-family: "Courier New", "Courier", monospace;}
code {font-size: 110%; font-family: "Courier New", "Courier", monospace;}
table {font-size: 90%;}
/*
* (c) Copyright Beman Dawes, 2014
* (c) Copyright Andrey Semashev, 2021
* Distributed under the Boost Software License, Version 1.0.
* See www.boost.org/LICENSE_1_0.txt
*/

View File

@@ -0,0 +1,52 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem Tickets</title>
</head>
<body>
<p>&nbsp;</p>
<h2>Locale related</h2>
<p><a href="https://svn.boost.org/trac/boost/ticket/3332">#3332</a>
boost::filesystem::path will get trouble in locale Chinese_Taiwan.950 (windows)<br>
<a href="https://svn.boost.org/trac/boost/ticket/7211">#7211</a> path_locale
destructor crashes when overloaded operator new and delete are present<br>
<a href="https://svn.boost.org/trac/boost/ticket/8388">#8388</a>
windows_file_codecvt should be allocated with _NEW_CRT<br>
<a href="https://svn.boost.org/trac/boost/ticket/8642">#8642</a> Global locale
prevents from using Boost.Filesystem in global constructors and destructors<br>
<a href="https://svn.boost.org/trac/boost/ticket/8930">#8930</a>
boost::path::root_directory() throws locale::facet::_S_create_c_locale name not
valid<br>
<a href="https://svn.boost.org/trac/boost/ticket/9182">#9182</a>
Boost-filesystem std::runtime_error: locale::facet::_S_create_c_locale name not
valid failure on Xamarin.Android<br>
<a href="https://svn.boost.org/trac/boost/ticket/9219">#9219</a> path::codecvt()
is called when not required<br>
<a href="https://svn.boost.org/trac/boost/ticket/9560">#9560</a>
operations_test_static unit test crashes during static initialization phase on
Mac/10.7/32-bit/darwin-4.2.1<br>
<a href="https://svn.boost.org/trac/boost/ticket/10205">#10205</a> FileSystem
runtime error: locale::facet::_S_create_c_locale name not valid<br>
<br>
&nbsp;</p>
<h2>TR alignment</h2>
<p>Work has started to bring the library into alignment with the C++ File System
Technical Specification (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html">HTML</a>)
(<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf">PDF</a>).
This work is occurring on the
<a href="https://github.com/boostorg/filesystem/tree/ts-develop">git <code>
ts-develop</code> branch</a>, and is currently very unstable. </p>
<ul>
<li><a href="https://svn.boost.org/trac/boost/ticket/10291">#10291</a> path
doesn't have move constructor/assignment operator.</li>
</ul>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,150 @@
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem V3 Intro</title>
<link href="styles.css" rel="stylesheet">
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem
Version 3<br>
Introduction</font></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<h1>Boost Filesystem Version 3</h1>
<p>Version 3 is a major revision of the Boost Filesystem library. Important
changes include:</p>
<ul>
<li>A single class <code>path</code> handles all aspects of
internationalization, replacing the previous template and its <code>path</code>
and <code>wpath</code> instantiations. Character types <code>char</code>,
<code>wchar_t</code>, <code>char16_t</code>, and <code>char32_t</code> are
supported. This is a major simplification of the path abstraction,
particularly for functions that take path arguments.<br>
&nbsp;</li>
<li>New <code>class path</code> members include:<br>
&nbsp;<ul>
<li><code><a href="reference.html#path-has_stem">has_stem</a>()</code></li>
<li><code><a href="reference.html#path-has_extension">has_extension</a>()</code></li>
<li><code><a href="reference.html#path-is_absolute">is_absolute</a>()</code>. This renames <code>is_complete()</code>, which
is now deprecated.</li>
<li><code><a href="reference.html#path-is_relative">is_relative</a>()</code></li>
<li><code><a href="reference.html#path-make_preferred">make_preferred</a>()<br>
&nbsp;</code></li>
</ul>
</li>
<li>New or improved operations functions include:<br>
&nbsp;<ul>
<li><code><a href="reference.html#absolute">absolute</a>()</code>. This replaces the operations function <code>
complete()</code>, which is now deprecated. Semantics are now provided for a
Windows corner case where the <code>base</code> argument was not an absolute
path. Previously this resulted in an exception being thrown.</li>
<li><code><a href="reference.html#create_symlink">create_symlink</a>()</code> now supported on both POSIX and Windows.</li>
<li><code><a href="reference.html#read_symlink">read_symlink</a>()</code> function added. Supported on both POSIX and
Windows. Used to read the contents of a symlink itself.</li>
<li><code><a href="reference.html#resize_file">resize_file</a>()</code> function added. Supported on both POSIX and
Windows. Used to shrink or grow a regular file.</li>
<li><code><a href="reference.html#unique_path">unique_path</a>()</code> function added. Supported on both POSIX and
Windows. Used to generate a secure temporary pathname.<br>
&nbsp;</li>
</ul>
</li>
<li>Support for error reporting via <code>error_code</code> is now uniform
throughout the operations functions.<br>
&nbsp;</li>
<li>Documentation has been reworked, including re-writes of major portions.<br>
&nbsp;</li>
<li>A new <a href="tutorial.html">Tutorial</a> provides a hopefully much
gentler and more complete introduction for new users. Current users might want
to review the <a href="tutorial.html">three sections related to class path</a>.</li>
</ul>
<h2>Deprecated names and other features</h2>
<p>See the <a href="deprecated.html">Deprecated Features page</a> for transition
aids that allow much existing code to compile without change using Version 3.</p>
<h2>Breaking changes</h2>
<p>To ease the transition, Versions 2 and 3 both used to be included in the next
several Boost releases. Version 2 was removed in Boost 1.50.0.</p>
<h3>Class <code>path</code></h3>
<ul>
<li>Class template <code>basic_path</code> and its specializations are
replaced by a single <code>class path</code>. Thus any code, such as
overloaded functions, that depends on <code>path</code> and <code>wpath</code>
being two distinct types will fail to compile and must be restructured.
Restructuring may be as simple as removing one of the overloads, but also
might require more complex redesign.<br>
&nbsp;</li>
<li>Certain functions now return <code>path</code> objects rather than <code>
string or wstring</code> objects:<ul>
<li><code>root_name()</code></li>
<li><code>root_directory()</code></li>
<li><code>filename()</code></li>
<li><code>stem()</code></li>
<li><code>extension()</code></li>
</ul>
<p>Not all uses will fail; if the function is being called in a context that
accepts a <code>path</code>, all is well. If the result is being used in a
context requiring a <code>std::string</code> or <code>std::wstring</code>,
then <code>.string()</code> or <code>.wstring()</code> respectively must be
appended to the function call.<br>
&nbsp;</li>
<li>&nbsp;<code>path::iterator::value_type</code> and&nbsp; <code>
path::const_iterator::value_type</code> is <code>path</code> rather than <code>
basic_string</code>.</li>
</ul>
<h3>Compiler support</h3>
<ul>
<li>Compilers and standard libraries that do not fully support wide characters
and wide character strings (<code>std::wstring</code>) are no longer
supported.<br>
&nbsp;</li>
<li>Cygwin versions prior to 1.7 are no longer supported because they lack
wide string support. Cygwin now compiles only for the Windows API and path
syntax.<br>
&nbsp;</li>
<li>MinGW versions not supporting wide strings are no longer supported.<br>
&nbsp;</li>
<li>Microsoft VC++ 7.1 and earlier are no longer supported.</li>
</ul>
<hr>
<p>&copy; Copyright Beman Dawes, 2009</p>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,198 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem V3 Design</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111">
<tr>
<td>
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" border="0"
width="300" height="86"></a></td>
<td align="middle">
<font size="7">Filesystem Version 3<br>
Design</font></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" align="right">
<tr>
<td width="100%" bgcolor="#D7EEFF" align="center">
<i><b>Contents</b></i></td>
</tr>
<tr>
<td width="100%" bgcolor="#E8F5FF">
<a href="#Introduction">Introduction</a><br>
<a href="#Problem">Problem</a><br>
<a href="#Solution">Solution</a><br>
<a href="#Details">Details</a><br>
<a href="#Other-changes">Other changes</a><br>
<a href="#Acknowledgements">Acknowledgements</a></td>
</tr>
</table>
<p><b>Caution:</b> This page documents thinking early in the V3 development
process, and is intended to serve historical purposes. It is not updated to
reflect the current state of the library.</p>
<h2><a name="Introduction">Introduction</a></h2>
<p>During the review of Boost.Filesystem.V2 (Internationalization), Peter Dimov
suggested that the <code>basic_path</code> class template was unwieldy, and that a single
path type that accommodated multiple character types and encodings would be more
flexible. Although I wasn't willing to stop development at that time to
explore how this idea might be implemented, or to break from the pattern for
Internationalization used the C++ standard library, I've often thought about
Peter's suggestion. With the advent of C++0x <code>char16_t</code> and <code>char32_t</code>
character
types, the <code>basic_path</code> class template approach becomes even more unwieldy, so it
is time to revisit the problem in light of Peter's suggestion.</p>
<h2><b><a name="Problem">Problem</a></b></h2>
<p>With Filesystem.V2, a path argument to a user defined function that is to
accommodate multiple character types and encodings must be written as a
template. Do-the-right-thing overloads or template metaprogramming must be
employed to allow arguments to be written as string literals. Here's what it
looks like:</p>
<blockquote>
<pre>template&lt;class Path&gt;
void foo( const Path &amp; p );</pre>
<pre>inline void foo( const path &amp; p )
{
return foo&lt;path&gt;( p );
}
inline void foo( const wpath &amp; p )
{
return foo&lt;wpath&gt;( p );
}</pre>
</blockquote>
<p>That's really ugly for such a simple need, and there would be a combinatorial
explosion if the function took multiple Path arguments and each could be either
narrow or wide. It gets even worse if the C++0x <code>char16_t</code> and <code>
char32_t</code> types are to be supported.</p>
<h2><a name="Solution">Solution</a></h2>
<p>Overview:</p>
<ul>
<li>A single, non-template, <code>class path</code>.</li>
<li>Each member function is a template accommodating the various
applicable character types, including user-defined character types.</li>
<li>Hold the path internally in a string of the type used by the operating
system API; <code>std::string</code> for POSIX, <code>std::wstring</code> for Windows.</li>
</ul>
<p>The signatures presented in <a href="#Problem">Problem</a> collapse to
simply:</p>
<blockquote>
<pre>void foo( const path &amp; p );</pre>
</blockquote>
<p>That's a signification reduction in code complexity. Specification becomes
simpler, too. I believe it will be far easier to teach, and result in much more
flexible user code.</p>
<p>Other benefits:</p>
<ul>
<li>All the polymorphism still occurs at compile time.</li>
<li>Efficiency is increased, in that conversions of the encoding, if required,
only occur once at the time of creation, not each time the path is used.</li>
<li>The size of the implementation code drops approximately in half and
becomes much more readable.</li>
</ul>
<p>Possible problems:</p>
<ul>
<li>The combination of member function templates and implicit constructors can
result in unclear error messages when the user makes simple commonplace coding
errors. This should be much less of a problem with C++ concepts, but in the
meantime work continues to restrict over aggressive templates via enable_if/disable_if.</li>
</ul>
<h2><a name="Details">Details</a></h2>
<table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" width="100%">
<tr>
<td width="33%" colspan="3">
<p align="center"><b><i>Encoding </i></b><i><b>Conversions</b></i></td>
</tr>
<tr>
<td width="33%">
<p align="center"><i><b>Host system</b></i></td>
<td width="33%">
<p align="center"><i><b>char string path arguments</b></i></td>
<td width="34%">
<p align="center"><i><b>wide string path arguments</b></i></td>
</tr>
<tr>
<td width="33%">Systems with <code>char</code> as the native API path character type (i.e.
POSIX-like systems)</td>
<td width="33%">No conversion.</td>
<td width="34%">Conversion occurs, performed by the current path locale's
<code>codecvt</code> facet.</td>
</tr>
<tr>
<td width="33%">Systems with <code>wchar_t</code> as the native API path character type
(i.e. Windows-like systems).</td>
<td width="33%">Conversion occurs, performed by the current path locale's
<code>codecvt</code> facet.</td>
<td width="34%">No conversion.</td>
</tr>
</table>
<p>When a class path function argument type matches the operating system's
API argument type for paths, no conversion is performed rather than conversion
to a specified encoding such as one of the Unicode encodings. This avoids
unintended consequences, etc.</p>
<h2><a name="Other-changes">Other changes</a></h2>
<p><b>Uniform hybrid error handling: </b>The hybrid error handling idiom has
been consistently applied to all applicable functions.</p>
<h2><a name="Acknowledgements">Acknowledgements</a></h2>
<p>Peter Dimov suggested the idea of a single path class that could cope with
multiple character types and encodings. Walter Landry contributed both the design
and implementation of the copy_any,
copy_directory, copy_symlink, and read_symlink functions.</p>
<hr>
<p>&copy; Copyright Beman Dawes, 2008</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Filesystem V4</title>
<link href="styles.css" rel="stylesheet">
<body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td width="277">
<a href="../../../index.htm">
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="300" height="86" border="0"></a></td>
<td align="middle">
<font size="7">Filesystem
Version 4<br></font></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" bgcolor="#D7EEFF" width="100%">
<tr>
<td><a href="index.htm">Home</a> &nbsp;&nbsp;
<a href="tutorial.html">Tutorial</a> &nbsp;&nbsp;
<a href="reference.html">Reference</a> &nbsp;&nbsp;
<a href="faq.htm">FAQ</a> &nbsp;&nbsp;
<a href="release_history.html">Releases</a> &nbsp;&nbsp;
<a href="portability_guide.htm">Portability</a> &nbsp;&nbsp;
<a href="v4.html">V4</a> &nbsp;&nbsp;
<a href="v3.html">V3 Intro</a> &nbsp;&nbsp;
<a href="v3_design.html">V3 Design</a> &nbsp;&nbsp;
<a href="deprecated.html">Deprecated</a> &nbsp;&nbsp;
<a href="issue_reporting.html">Bug Reports </a>&nbsp;&nbsp;
</td>
</table>
<h1>Boost Filesystem Version 4</h1>
<p>Version 4 is a significant revision of the Boost Filesystem library that makes its interface and
behavior closer to std::filesystem that was introduced in C++17 and updated in the later standards.
It removes the features that were <a href="deprecated.html">deprecated</a> in Version 3 and makes a number of breaking changes.</p>
<p>Users can select Boost.Filesystem v4 version by defining <code>BOOST_FILESYSTEM_VERSION</code> macro to 4 when compiling their code. There is no need to separately compile Boost.Filesystem for each library version &mdash; a single binary supports both v3 and v4. Users should avoid using both v3 and v4 in the same application as this can lead to subtle bugs.</p>
<h2>Breaking changes</h2>
<ul>
<li><a href="reference.html#path-filename"><code>path::filename</code></a> no longer returns root name or root directory if the path contains no
other elements. For example, on Windows <code>path("C:").filename()</code> used to return "C:" and <code>path("C:\").filename()</code> used to return "\" and both will return an empty path now. This also affects <code>path::stem</code> and <code>path::extension</code> methods, as those are based on <code>path::filename</code>.</li>
<li><a href="reference.html#path-stem"><code>path::stem</code></a> and <a href="reference.html#path-extension"><code>path::extension</code></a> no longer treat a filename that starts with a dot and has no other dots as an extension. Filenames starting with a dot are commonly treated as filenames with an empty extension. The leading dot is used to indicate a hidden file on most UNIX-like systems.</li>
<li><a href="reference.html#path-filename"><code>path::filename</code></a> and <a href="reference.html#path-iterators"><code>path::iterator</code></a> no longer return an implicit trailing dot (".") element if the path ends with a directory separator. Instead, an empty path is returned, similar to C++17 std::filesystem. This also affects other methods that are defined in terms of iterators or filename, such as <code>path::stem</code>, <code>path::compare</code> or <code>lexicographical_compare</code>. For example, <code>path("a/b/") == path("a/b/.")</code> no longer holds true.</li>
<li><a href="reference.html#lexically_normal"><code>path::lexically_normal</code></a> no longer produces a trailing dot (".") element and omits a directory separator after a trailing dot-dot ("..") element in the normalized paths.</li>
<li><a href="reference.html#path-appends"><code>path</code> appends</a> consider root name and root directory of the appended path. If the appended path is absolute, or root name is present and differs from the source path, the resulting path is equivalent to the appended path. If root directory is present, the result is the root directory and relative path rebased on top of the root name of the source path. Otherwise, the behavior is similar to v3. This behavior is similar to C++17 std::filesystem.</li>
</ul>
<hr>
<p>&copy; Copyright Andrey Semashev, 2021</p>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>

View File

@@ -0,0 +1,25 @@
# Boost Filesystem Library Example Jamfile
# (C) Copyright Vladimir Prus 2003
# Distributed under the Boost Software License, Version 1.0.
# See www.boost.org/LICENSE_1_0.txt
# Library home page: http://www.boost.org/libs/filesystem
project
: requirements
<library>/boost/filesystem//boost_filesystem
<link>static
;
exe tut0 : tut0.cpp ;
exe tut1 : tut1.cpp ;
exe tut2 : tut2.cpp ;
exe tut3 : tut3.cpp : <cxxstd>11 ;
exe tut4 : tut4.cpp : <cxxstd>11 ;
exe tut5 : tut5.cpp ;
exe path_info : path_info.cpp : <cxxstd>11 ;
exe file_status : file_status.cpp ;
exe file_size : file_size.cpp ;
exe directory_symlink_parent_resolution : directory_symlink_parent_resolution.cpp ;

View File

@@ -0,0 +1,42 @@
// directory_symlink_parent_resolution.cpp -------------------------------------------//
// Copyright Beman Dawes 2015
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <boost/filesystem.hpp>
#include <boost/filesystem/string_file.hpp>
#include <boost/detail/lightweight_main.hpp>
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using namespace boost::filesystem;
int cpp_main(int argc, char* argv[])
{
#ifdef BOOST_WINDOWS_API
cout << "BOOST_WINDOWS_API" << endl;
#else
cout << "BOOST_POSIX_API" << endl;
#endif
path test_dir(current_path() / "dspr_demo");
remove_all(test_dir);
create_directories(test_dir / "a/c/d");
current_path(test_dir / "a");
create_directory_symlink("c/d", "b");
save_string_file("name.txt", "Windows");
save_string_file("c/name.txt", "POSIX");
current_path(test_dir);
std::string s;
load_string_file("a/b/../name.txt", s);
cout << s << endl;
return 0;
}

View File

@@ -0,0 +1,200 @@
// error_demo.cpp --------------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
// //
// The purpose of this program is to demonstrate how error reporting works. //
// //
//--------------------------------------------------------------------------------------//
#include <boost/filesystem.hpp>
#include <boost/system/system_error.hpp>
#include <iostream>
using std::cout;
using boost::filesystem::path;
using boost::filesystem::filesystem_error;
using boost::system::error_code;
using boost::system::system_error;
namespace fs = boost::filesystem;
namespace {
void report_system_error(const system_error& ex)
{
cout << " threw system_error:\n"
<< " ex.code().value() is " << ex.code().value() << '\n'
<< " ex.code().category().name() is " << ex.code().category().name() << '\n'
<< " ex.what() is " << ex.what() << '\n';
}
void report_filesystem_error(const system_error& ex)
{
cout << " threw filesystem_error exception:\n"
<< " ex.code().value() is " << ex.code().value() << '\n'
<< " ex.code().category().name() is " << ex.code().category().name() << '\n'
<< " ex.what() is " << ex.what() << '\n';
}
void report_status(fs::file_status s)
{
cout << " file_status::type() is ";
switch (s.type())
{
case fs::status_error:
cout << "status_error\n";
break;
case fs::file_not_found:
cout << "file_not_found\n";
break;
case fs::regular_file:
cout << "regular_file\n";
break;
case fs::directory_file:
cout << "directory_file\n";
break;
case fs::symlink_file:
cout << "symlink_file\n";
break;
case fs::block_file:
cout << "block_file\n";
break;
case fs::character_file:
cout << "character_file\n";
break;
case fs::fifo_file:
cout << "fifo_file\n";
break;
case fs::socket_file:
cout << "socket_file\n";
break;
case fs::type_unknown:
cout << "type_unknown\n";
break;
default:
cout << "not a valid enumeration constant\n";
}
}
void report_error_code(const error_code& ec)
{
cout << " ec:\n"
<< " value() is " << ec.value() << '\n'
<< " category().name() is " << ec.category().name() << '\n'
<< " message() is " << ec.message() << '\n';
}
bool threw_exception;
} // namespace
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: error_demo path\n";
return 1;
}
error_code ec;
//// construct path - no error_code
//try { path p1(argv[1]); }
//catch (const system_error& ex)
//{
// cout << "construct path without error_code";
// report_system_error(ex);
//}
//// construct path - with error_code
path p(argv[1]);
fs::file_status s;
bool b(false);
fs::directory_iterator di;
// get status - no error_code
cout << "\nstatus(\"" << p.string() << "\");\n";
threw_exception = false;
try
{
s = fs::status(p);
}
catch (const system_error& ex)
{
report_filesystem_error(ex);
threw_exception = true;
}
if (!threw_exception)
cout << " Did not throw exception\n";
report_status(s);
// get status - with error_code
cout << "\nstatus(\"" << p.string() << "\", ec);\n";
s = fs::status(p, ec);
report_status(s);
report_error_code(ec);
// query existence - no error_code
cout << "\nexists(\"" << p.string() << "\");\n";
threw_exception = false;
try
{
b = fs::exists(p);
}
catch (const system_error& ex)
{
report_filesystem_error(ex);
threw_exception = true;
}
if (!threw_exception)
{
cout << " Did not throw exception\n"
<< " Returns: " << (b ? "true" : "false") << '\n';
}
// query existence - with error_code
// directory_iterator - no error_code
cout << "\ndirectory_iterator(\"" << p.string() << "\");\n";
threw_exception = false;
try
{
di = fs::directory_iterator(p);
}
catch (const system_error& ex)
{
report_filesystem_error(ex);
threw_exception = true;
}
if (!threw_exception)
{
cout << " Did not throw exception\n"
<< (di == fs::directory_iterator() ? " Equal" : " Not equal")
<< " to the end iterator\n";
}
// directory_iterator - with error_code
cout << "\ndirectory_iterator(\"" << p.string() << "\", ec);\n";
di = fs::directory_iterator(p, ec);
cout << (di == fs::directory_iterator() ? " Equal" : " Not equal")
<< " to the end iterator\n";
report_error_code(ec);
return 0;
}

View File

@@ -0,0 +1,44 @@
// file_size program -------------------------------------------------------//
// Copyright Beman Dawes, 2004
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/filesystem for documentation.
#include <boost/filesystem/operations.hpp>
#include <iostream>
namespace fs = boost::filesystem;
int main(int argc, char* argv[])
{
if (argc != 2)
{
std::cout << "Usage: file_size path\n";
return 1;
}
std::cout << "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n';
fs::path p(argv[1]);
if (!fs::exists(p))
{
std::cout << "not found: " << argv[1] << std::endl;
return 1;
}
if (!fs::is_regular(p))
{
std::cout << "not a regular file: " << argv[1] << std::endl;
return 1;
}
std::cout << "size of " << argv[1] << " is " << fs::file_size(p)
<< std::endl;
return 0;
}

View File

@@ -0,0 +1,116 @@
// status.cpp ------------------------------------------------------------------------//
// Copyright Beman Dawes 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <boost/config.hpp>
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include <boost/detail/lightweight_main.hpp>
using std::cout;
using std::endl;
using namespace boost::filesystem;
namespace {
path p;
void print_boost_macros()
{
std::cout << "Boost "
<< BOOST_VERSION / 100000 << '.'
<< BOOST_VERSION / 100 % 1000 << '.'
<< BOOST_VERSION % 100 << ", "
#ifndef _WIN64
<< BOOST_COMPILER << ", "
#else
<< BOOST_COMPILER << " with _WIN64 defined, "
#endif
<< BOOST_STDLIB << ", "
<< BOOST_PLATFORM
<< std::endl;
}
const char* file_type_tab[] = { "status_error", "file_not_found", "regular_file", "directory_file",
"symlink_file", "block_file", "character_file", "fifo_file", "socket_file",
"type_unknown" };
const char* file_type_c_str(enum file_type t)
{
return file_type_tab[t];
}
void show_status(file_status s, boost::system::error_code ec)
{
boost::system::error_condition econd;
if (ec)
{
econd = ec.default_error_condition();
cout << "sets ec to indicate an error:\n"
<< " ec.value() is " << ec.value() << '\n'
<< " ec.message() is \"" << ec.message() << "\"\n"
<< " ec.default_error_condition().value() is " << econd.value() << '\n'
<< " ec.default_error_condition().message() is \"" << econd.message() << "\"\n";
}
else
cout << "clears ec.\n";
cout << "s.type() is " << s.type()
<< ", which is defined as \"" << file_type_c_str(s.type()) << "\"\n";
cout << "exists(s) is " << (exists(s) ? "true" : "false") << "\n";
cout << "status_known(s) is " << (status_known(s) ? "true" : "false") << "\n";
cout << "is_regular_file(s) is " << (is_regular_file(s) ? "true" : "false") << "\n";
cout << "is_directory(s) is " << (is_directory(s) ? "true" : "false") << "\n";
cout << "is_other(s) is " << (is_other(s) ? "true" : "false") << "\n";
cout << "is_symlink(s) is " << (is_symlink(s) ? "true" : "false") << "\n";
}
void try_exists()
{
cout << "\nexists(" << p << ") ";
try
{
bool result = exists(p);
cout << "is " << (result ? "true" : "false") << "\n";
}
catch (const filesystem_error& ex)
{
cout << "throws a filesystem_error exception: " << ex.what() << "\n";
}
}
} // namespace
int cpp_main(int argc, char* argv[])
{
print_boost_macros();
if (argc < 2)
{
std::cout << "Usage: file_status <path>\n";
p = argv[0];
}
else
p = argv[1];
boost::system::error_code ec;
file_status s = status(p, ec);
cout << "\nfile_status s = status(" << p << ", ec) ";
show_status(s, ec);
s = symlink_status(p, ec);
cout << "\nfile_status s = symlink_status(" << p << ", ec) ";
show_status(s, ec);
try_exists();
return 0;
}

View File

@@ -0,0 +1,100 @@
// Boost.Filesystem mbcopy.cpp ---------------------------------------------//
// Copyright Beman Dawes 2005
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Copy the files in a directory, using mbpath to represent the new file names
// See http://../doc/path.htm#mbpath for more information
// See deprecated_test for tests of deprecated features
#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem/config.hpp>
#ifdef BOOST_FILESYSTEM_NARROW_ONLY
#error This compiler or standard library does not support wide-character strings or paths
#endif
#include "mbpath.hpp"
#include <iostream>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include "../src/utf8_codecvt_facet.hpp"
namespace fs = boost::filesystem;
namespace {
// we can't use boost::filesystem::copy_file() because the argument types
// differ, so provide a not-very-smart replacement.
void copy_file(const fs::wpath& from, const user::mbpath& to)
{
fs::ifstream from_file(from, std::ios_base::in | std::ios_base::binary);
if (!from_file)
{
std::cout << "input open failed\n";
return;
}
fs::ofstream to_file(to, std::ios_base::out | std::ios_base::binary);
if (!to_file)
{
std::cout << "output open failed\n";
return;
}
char c;
while (from_file.get(c))
{
to_file.put(c);
if (to_file.fail())
{
std::cout << "write error\n";
return;
}
}
if (!from_file.eof())
{
std::cout << "read error\n";
}
}
} // namespace
int main(int argc, char* argv[])
{
if (argc != 2)
{
std::cout << "Copy files in the current directory to a target directory\n"
<< "Usage: mbcopy <target-dir>\n";
return 1;
}
// For encoding, use Boost UTF-8 codecvt
std::locale global_loc = std::locale();
std::locale loc(global_loc, new fs::detail::utf8_codecvt_facet);
user::mbpath_traits::imbue(loc);
std::string target_string(argv[1]);
user::mbpath target_dir(user::mbpath_traits::to_internal(target_string));
if (!fs::is_directory(target_dir))
{
std::cout << "Error: " << argv[1] << " is not a directory\n";
return 1;
}
for (fs::wdirectory_iterator it(L".");
it != fs::wdirectory_iterator(); ++it)
{
if (fs::is_regular_file(it->status()))
{
copy_file(*it, target_dir / it->path().filename());
}
}
return 0;
}

View File

@@ -0,0 +1,78 @@
// Boost.Filesystem mbpath.cpp ---------------------------------------------//
// (c) Copyright Beman Dawes 2005
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See Boost.Filesystem home page at http://www.boost.org/libs/filesystem
#include <boost/filesystem/config.hpp>
#ifdef BOOST_FILESYSTEM_NARROW_ONLY
#error This compiler or standard library does not support wide-character strings or paths
#endif
#include "mbpath.hpp"
#include <boost/system/system_error.hpp>
#include <boost/scoped_array.hpp>
namespace fs = boost::filesystem;
namespace {
// ISO C calls this "the locale-specific native environment":
std::locale loc("");
const std::codecvt< wchar_t, char, std::mbstate_t >*
cvt(&std::use_facet< std::codecvt< wchar_t, char, std::mbstate_t > >(loc));
} // namespace
namespace user {
mbpath_traits::external_string_type
mbpath_traits::to_external(const mbpath& ph, const internal_string_type& src)
{
std::size_t work_size(cvt->max_length() * (src.size() + 1));
boost::scoped_array< char > work(new char[work_size]);
std::mbstate_t state;
const internal_string_type::value_type* from_next;
external_string_type::value_type* to_next;
if (cvt->out(
state, src.c_str(), src.c_str() + src.size(), from_next, work.get(),
work.get() + work_size, to_next) != std::codecvt_base::ok)
boost::throw_exception< fs::basic_filesystem_error< mbpath > >(
fs::basic_filesystem_error< mbpath >(
"user::mbpath::to_external conversion error",
ph, boost::system::error_code(EINVAL, boost::system::errno_ecat)));
*to_next = '\0';
return external_string_type(work.get());
}
mbpath_traits::internal_string_type
mbpath_traits::to_internal(const external_string_type& src)
{
std::size_t work_size(src.size() + 1);
boost::scoped_array< wchar_t > work(new wchar_t[work_size]);
std::mbstate_t state;
const external_string_type::value_type* from_next;
internal_string_type::value_type* to_next;
if (cvt->in(
state, src.c_str(), src.c_str() + src.size(), from_next, work.get(),
work.get() + work_size, to_next) != std::codecvt_base::ok)
boost::throw_exception< fs::basic_filesystem_error< mbpath > >(
fs::basic_filesystem_error< mbpath >(
"user::mbpath::to_internal conversion error",
boost::system::error_code(EINVAL, boost::system::errno_ecat)));
*to_next = L'\0';
return internal_string_type(work.get());
}
void mbpath_traits::imbue(const std::locale& new_loc)
{
loc = new_loc;
cvt = &std::use_facet< std::codecvt< wchar_t, char, std::mbstate_t > >(loc);
}
} // namespace user

View File

@@ -0,0 +1,47 @@
// Boost.Filesystem mbpath.hpp ---------------------------------------------//
// Copyright Beman Dawes 2005
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Encodes wide character paths as MBCS
// See http://../doc/path.htm#mbpath for more information
#include <boost/filesystem/path.hpp>
#include <cwchar> // for std::mbstate_t
#include <string>
#include <locale>
namespace user {
struct mbpath_traits;
typedef boost::filesystem::basic_path< std::wstring, mbpath_traits > mbpath;
struct mbpath_traits
{
typedef std::wstring internal_string_type;
typedef std::string external_string_type;
static external_string_type to_external(const mbpath& ph, const internal_string_type& src);
static internal_string_type to_internal(const external_string_type& src);
static void imbue(const std::locale& loc);
};
} // namespace user
namespace boost {
namespace filesystem {
template<>
struct is_basic_path< user::mbpath >
{
static const bool value = true;
};
} // namespace filesystem
} // namespace boost

View File

@@ -0,0 +1,86 @@
// path_info.cpp ---------------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
const char* say_what(bool b)
{
return b ? "true" : "false";
}
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: path_info path-element [path-element...]\n"
"Composes a path via operator/= from one or more path-element arguments\n"
"Example: path_info foo/bar baz\n"
#ifdef BOOST_POSIX_API
" would report info about the composed path foo/bar/baz\n";
#else // BOOST_WINDOWS_API
" would report info about the composed path foo/bar\\baz\n";
#endif
return 1;
}
path p;
for (; argc > 1; --argc, ++argv)
p /= argv[1]; // compose path p from the command line arguments
cout << "\ncomposed path:\n";
cout << " operator<<()---------: " << p << "\n";
cout << " make_preferred()-----: " << p.make_preferred() << "\n";
cout << "\nelements:\n";
for (auto element : p)
cout << " " << element << '\n';
cout << "\nobservers, native format:" << endl;
#ifdef BOOST_POSIX_API
cout << " native()-------------: " << p.native() << endl;
cout << " c_str()--------------: " << p.c_str() << endl;
#else // BOOST_WINDOWS_API
wcout << L" native()-------------: " << p.native() << endl;
wcout << L" c_str()--------------: " << p.c_str() << endl;
#endif
cout << " string()-------------: " << p.string() << endl;
wcout << L" wstring()------------: " << p.wstring() << endl;
cout << "\nobservers, generic format:\n";
cout << " generic_string()-----: " << p.generic_string() << endl;
wcout << L" generic_wstring()----: " << p.generic_wstring() << endl;
cout << "\ndecomposition:\n";
cout << " root_name()----------: " << p.root_name() << '\n';
cout << " root_directory()-----: " << p.root_directory() << '\n';
cout << " root_path()----------: " << p.root_path() << '\n';
cout << " relative_path()------: " << p.relative_path() << '\n';
cout << " parent_path()--------: " << p.parent_path() << '\n';
cout << " filename()-----------: " << p.filename() << '\n';
cout << " stem()---------------: " << p.stem() << '\n';
cout << " extension()----------: " << p.extension() << '\n';
cout << "\nquery:\n";
cout << " empty()--------------: " << say_what(p.empty()) << '\n';
cout << " is_absolute()--------: " << say_what(p.is_absolute()) << '\n';
cout << " has_root_name()------: " << say_what(p.has_root_name()) << '\n';
cout << " has_root_directory()-: " << say_what(p.has_root_directory()) << '\n';
cout << " has_root_path()------: " << say_what(p.has_root_path()) << '\n';
cout << " has_relative_path()--: " << say_what(p.has_relative_path()) << '\n';
cout << " has_parent_path()----: " << say_what(p.has_parent_path()) << '\n';
cout << " has_filename()-------: " << say_what(p.has_filename()) << '\n';
cout << " has_stem()-----------: " << say_what(p.has_stem()) << '\n';
cout << " has_extension()------: " << say_what(p.has_extension()) << '\n';
return 0;
}

View File

@@ -0,0 +1,90 @@
// simple_ls program -------------------------------------------------------//
// Copyright Jeff Garland and Beman Dawes, 2002
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/filesystem for documentation.
// As an example program, we don't want to use any deprecated features
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
#define BOOST_FILESYSTEM_NO_DEPRECATED
#endif
#ifndef BOOST_SYSTEM_NO_DEPRECATED
#define BOOST_SYSTEM_NO_DEPRECATED
#endif
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/path.hpp>
#include <iostream>
namespace fs = boost::filesystem;
int main(int argc, char* argv[])
{
fs::path p(fs::current_path());
if (argc > 1)
p = fs::system_complete(argv[1]);
else
std::cout << "\nusage: simple_ls [path]" << std::endl;
unsigned long file_count = 0;
unsigned long dir_count = 0;
unsigned long other_count = 0;
unsigned long err_count = 0;
if (!fs::exists(p))
{
std::cout << "\nNot found: " << p << std::endl;
return 1;
}
if (fs::is_directory(p))
{
std::cout << "\nIn directory: " << p << "\n\n";
fs::directory_iterator end_iter;
for (fs::directory_iterator dir_itr(p);
dir_itr != end_iter;
++dir_itr)
{
try
{
if (fs::is_directory(dir_itr->status()))
{
++dir_count;
std::cout << dir_itr->path().filename() << " [directory]\n";
}
else if (fs::is_regular_file(dir_itr->status()))
{
++file_count;
std::cout << dir_itr->path().filename() << "\n";
}
else
{
++other_count;
std::cout << dir_itr->path().filename() << " [other]\n";
}
}
catch (const std::exception& ex)
{
++err_count;
std::cout << dir_itr->path().filename() << " " << ex.what() << std::endl;
}
}
std::cout << "\n"
<< file_count << " files\n"
<< dir_count << " directories\n"
<< other_count << " others\n"
<< err_count << " errors\n";
}
else // must be a file
{
std::cout << "\nFound: " << p << "\n";
}
return 0;
}

View File

@@ -0,0 +1,31 @@
// filesystem example stems.cpp ------------------------------------------------------//
// Copyright Beman Dawes 2011
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <boost/filesystem.hpp>
#include <iostream>
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: stems <path>\n";
return 1;
}
boost::filesystem::path p(argv[1]), name(p.filename());
for (;;)
{
std::cout << "filename " << name << " has stem " << name.stem()
<< " and extension " << name.extension() << "\n";
if (name.stem().empty() || name.extension().empty())
return 0;
name = name.stem();
}
}

View File

@@ -0,0 +1,39 @@
// Example use of Microsoft TCHAR ----------------------------------------------------//
// Copyright Beman Dawes 2008
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <string>
#include <cassert>
#include <windows.h>
#include <winnt.h>
namespace fs = boost::filesystem;
typedef std::basic_string< TCHAR > tstring;
void func(fs::path const& p)
{
assert(fs::exists(p));
}
int main()
{
// get a path that is known to exist
fs::path cp = fs::current_path();
// demo: get tstring from the path
tstring cp_as_tstring = cp.string< tstring >();
// demo: pass tstring to filesystem function taking path
assert(fs::exists(cp_as_tstring));
// demo: pass tstring to user function taking path
func(cp_as_tstring);
return 0;
}

View File

@@ -0,0 +1,24 @@
// filesystem tut0.cpp ---------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut0 path\n";
return 1;
}
std::cout << argv[1] << '\n';
return 0;
}

View File

@@ -0,0 +1,24 @@
// filesystem tut1.cpp ---------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut1 path\n";
return 1;
}
std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
return 0;
}

View File

@@ -0,0 +1,39 @@
// filesystem tut2.cpp ---------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: tut2 path\n";
return 1;
}
path p(argv[1]); // avoid repeated path construction below
if (exists(p)) // does path p actually exist?
{
if (is_regular_file(p)) // is path p a regular file?
cout << p << " size is " << file_size(p) << '\n';
else if (is_directory(p)) // is path p a directory?
cout << p << " is a directory\n";
else
cout << p << " exists, but is not a regular file or directory\n";
}
else
cout << p << " does not exist\n";
return 0;
}

View File

@@ -0,0 +1,53 @@
// filesystem tut3.cpp ---------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <boost/filesystem.hpp>
using std::cout;
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: tut3 path\n";
return 1;
}
path p(argv[1]);
try
{
if (exists(p))
{
if (is_regular_file(p))
{
cout << p << " size is " << file_size(p) << '\n';
}
else if (is_directory(p))
{
cout << p << " is a directory containing:\n";
for (directory_entry const& x : directory_iterator(p))
cout << " " << x.path() << '\n';
}
else
cout << p << " exists, but is not a regular file or directory\n";
}
else
cout << p << " does not exist\n";
}
catch (filesystem_error& ex)
{
cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,62 @@
// filesystem tut4.cpp ---------------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/filesystem.hpp>
using std::cout;
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
cout << "Usage: tut4 path\n";
return 1;
}
path p(argv[1]);
try
{
if (exists(p))
{
if (is_regular_file(p))
{
cout << p << " size is " << file_size(p) << '\n';
}
else if (is_directory(p))
{
cout << p << " is a directory containing:\n";
std::vector< path > v;
for (auto&& x : directory_iterator(p))
v.push_back(x.path());
std::sort(v.begin(), v.end());
for (auto&& x : v)
cout << " " << x.filename() << '\n';
}
else
cout << p << " exists, but is not a regular file or directory\n";
}
else
cout << p << " does not exist\n";
}
catch (filesystem_error& ex)
{
cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,69 @@
// filesystem tut5.cpp ---------------------------------------------------------------//
// Copyright Beman Dawes 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <boost/filesystem/fstream.hpp>
#include <string>
#include <list>
namespace fs = boost::filesystem;
int main()
{
// \u263A is "Unicode WHITE SMILING FACE = have a nice day!"
std::string narrow_string("smile2");
std::wstring wide_string(L"smile2\u263A");
std::list< char > narrow_list;
narrow_list.push_back('s');
narrow_list.push_back('m');
narrow_list.push_back('i');
narrow_list.push_back('l');
narrow_list.push_back('e');
narrow_list.push_back('3');
std::list< wchar_t > wide_list;
wide_list.push_back(L's');
wide_list.push_back(L'm');
wide_list.push_back(L'i');
wide_list.push_back(L'l');
wide_list.push_back(L'e');
wide_list.push_back(L'3');
wide_list.push_back(L'\u263A');
{
fs::ofstream f("smile");
}
{
fs::ofstream f(L"smile\u263A");
}
{
fs::ofstream f(narrow_string);
}
{
fs::ofstream f(wide_string);
}
{
fs::ofstream f(narrow_list);
}
{
fs::ofstream f(wide_list);
}
narrow_list.pop_back();
narrow_list.push_back('4');
wide_list.pop_back();
wide_list.pop_back();
wide_list.push_back(L'4');
wide_list.push_back(L'\u263A');
{
fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end()));
}
{
fs::ofstream f(fs::path(wide_list.begin(), wide_list.end()));
}
return 0;
}

View File

@@ -0,0 +1,48 @@
// filesystem tut6a.cpp --------------------------------------------------------------//
// Copyright Beman Dawes 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <exception>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut6a path\n";
return 1;
}
try
{
for (recursive_directory_iterator it(argv[1]);
it != recursive_directory_iterator();
++it)
{
if (it.level() > 1)
it.pop();
else
{
for (int i = 0; i <= it.level(); ++i)
std::cout << " ";
std::cout << it->path() << '\n';
}
}
}
catch (std::exception& ex)
{
std::cout << "************* exception *****************\n";
std::cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,52 @@
// filesystem tut6b.cpp --------------------------------------------------------------//
// Copyright Beman Dawes 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <exception>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut6b path\n";
return 1;
}
try
{
for (recursive_directory_iterator it(argv[1]);
it != recursive_directory_iterator();)
{
for (int i = 0; i <= it.level(); ++i)
std::cout << " ";
std::cout << it->path() << '\n';
try
{
++it;
}
catch (filesystem_error& ex)
{
std::cout << "************* filesystem_error *****************\n";
std::cout << ex.what() << '\n';
}
}
}
catch (std::exception& ex)
{
std::cout << "************* exception *****************\n";
std::cout << ex.what() << '\n';
}
return 0;
}

View File

@@ -0,0 +1,39 @@
// filesystem tut6c.cpp --------------------------------------------------------------//
// Copyright Beman Dawes 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#include <iostream>
#include <exception>
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
using namespace boost::filesystem;
using namespace boost::system;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut6c path\n";
return 1;
}
error_code ec;
for (recursive_directory_iterator it(argv[1], ec);
it != recursive_directory_iterator();)
{
for (int i = 0; i <= it.level(); ++i)
std::cout << " ";
std::cout << it->path() << '\n';
it.increment(ec);
}
return 0;
}

View File

@@ -0,0 +1,26 @@
// boost/filesystem.hpp --------------------------------------------------------------//
// Copyright Beman Dawes 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP
#define BOOST_FILESYSTEM_FILESYSTEM_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/file_status.hpp>
#include <boost/filesystem/convenience.hpp>
#if defined(BOOST_FILESYSTEM_DEPRECATED)
#include <boost/filesystem/string_file.hpp>
#endif
#endif // BOOST_FILESYSTEM_FILESYSTEM_HPP

View File

@@ -0,0 +1,125 @@
// boost/filesystem/v3/config.hpp ----------------------------------------------------//
// Copyright Beman Dawes 2003
// Copyright Andrey Semashev 2021
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_CONFIG_HPP
#define BOOST_FILESYSTEM_CONFIG_HPP
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
#include <boost/config.hpp>
#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API
#include <boost/detail/workaround.hpp>
#if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 && BOOST_FILESYSTEM_VERSION != 4
#error Compiling Boost.Filesystem file with BOOST_FILESYSTEM_VERSION defined != 3 or 4
#endif
#if defined(BOOST_FILESYSTEM_SOURCE)
#undef BOOST_FILESYSTEM_VERSION
#define BOOST_FILESYSTEM_VERSION 4
#elif !defined(BOOST_FILESYSTEM_VERSION)
#define BOOST_FILESYSTEM_VERSION 3
#endif
#define BOOST_FILESYSTEM_VERSIONED_SYM(sym) BOOST_JOIN(sym, BOOST_JOIN(_v, BOOST_FILESYSTEM_VERSION))
#if BOOST_FILESYSTEM_VERSION == 4
#undef BOOST_FILESYSTEM_DEPRECATED
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
#define BOOST_FILESYSTEM_NO_DEPRECATED
#endif
#endif
#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions
// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
#ifdef BOOST_FILESYSTEM_SOURCE
#define BOOST_FILESYSTEM_DEPRECATED
#undef BOOST_FILESYSTEM_NO_DEPRECATED // fixes #9454, src bld fails if NO_DEP defined
#endif
#if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
#error Both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
#endif
// throw an exception ----------------------------------------------------------------//
//
// Exceptions were originally thrown via boost::throw_exception().
// As throw_exception() became more complex, it caused user error reporting
// to be harder to interpret, since the exception reported became much more complex.
// The immediate fix was to throw directly, wrapped in a macro to make any later change
// easier.
#define BOOST_FILESYSTEM_THROW(EX) throw EX
#if defined(BOOST_NO_STD_WSTRING)
#error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
#endif
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
// normalize macros ------------------------------------------------------------------//
#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK)
#define BOOST_FILESYSTEM_STATIC_LINK
#endif
#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK)
#define BOOST_FILESYSTEM_DYN_LINK
#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
#define BOOST_FILESYSTEM_STATIC_LINK
#endif
#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK)
#error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK
#endif
#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
#define BOOST_FILESYSTEM_NO_LIB
#endif
// enable dynamic linking ------------------------------------------------------------//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
#if defined(BOOST_FILESYSTEM_SOURCE)
#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
#else
#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
#endif
#else
#define BOOST_FILESYSTEM_DECL
#endif
// enable automatic library variant selection ----------------------------------------//
#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_filesystem
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
#define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#endif // BOOST_FILESYSTEM_CONFIG_HPP

View File

@@ -0,0 +1,52 @@
// boost/filesystem/convenience.hpp ----------------------------------------//
// Copyright Beman Dawes, 2002-2005
// Copyright Vladimir Prus, 2002
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See library home page at http://www.boost.org/libs/filesystem
//----------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_CONVENIENCE_HPP
#define BOOST_FILESYSTEM_CONVENIENCE_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/system/error_code.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
namespace filesystem {
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline std::string extension(const path& p)
{
return p.extension().string();
}
inline std::string basename(const path& p)
{
return p.stem().string();
}
inline path change_extension(const path& p, const path& new_extension)
{
path new_p(p);
new_p.replace_extension(new_extension);
return new_p;
}
#endif
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_CONVENIENCE_HPP

View File

@@ -0,0 +1,23 @@
/*
* Copyright Andrey Semashev 2021.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#if !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#elif (defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \
&& (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#endif // !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)
#include <boost/config/abi_suffix.hpp>

View File

@@ -0,0 +1,43 @@
/*
* Copyright Andrey Semashev 2021.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/config/abi_prefix.hpp>
#if !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push, 3)
// 'm_A' : class 'A' needs to have dll-interface to be used by clients of class 'B'
#pragma warning(disable: 4251)
// non dll-interface class 'A' used as base for dll-interface class 'B'
#pragma warning(disable: 4275)
// 'int' : forcing value to bool 'true' or 'false' (performance warning)
#pragma warning(disable: 4800)
// unreferenced formal parameter
#pragma warning(disable: 4100)
// conditional expression is constant
#pragma warning(disable: 4127)
// function marked as __forceinline not inlined
#pragma warning(disable: 4714)
// decorated name length exceeded, name was truncated
#pragma warning(disable: 4503)
// 'X': This function or variable may be unsafe. Consider using Y instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
#pragma warning(disable: 4996)
#elif (defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \
&& (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) || defined(__clang__)
// Note: clang-cl goes here as well, as it seems to support gcc-style warning control pragmas.
#pragma GCC diagnostic push
// unused parameter 'arg'
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#endif // !defined(BOOST_FILESYSTEM_ENABLE_WARNINGS)

View File

@@ -0,0 +1,42 @@
// boost/filesystem/detail/macro_value.hpp -------------------------------------------//
// (C) Copyright John Maddock 2001 - 2003
// (C) Copyright Jens Maurer 2001
// (C) Copyright Peter Dimov 2001
// (C) Copyright Darin Adler 2001
// (C) Copyright Beman Dawes 2002
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_MACRO_VALUE_HPP
#define BOOST_FILESYSTEM_MACRO_VALUE_HPP
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <cstdlib>
namespace boost {
namespace detail {
inline const char* macro_value(const char* name, const char* value)
{
static const char* no_value = "[no value]";
static const char* not_defined = "[not defined]";
BOOST_ASSERT_MSG(name, "name argument must not be a null pointer");
BOOST_ASSERT_MSG(value, "value argument must not be a null pointer");
return strcmp(name, value + 1) ? ((*value && *(value + 1)) ? (value + 1) : no_value) : not_defined; // name == value+1 so the macro is not defined
}
} // namespace detail
} // namespace boost
#define BOOST_MACRO_VALUE(X) boost::detail::macro_value(#X, BOOST_STRINGIZE(=X))
#endif // BOOST_FILESYSTEM_MACRO_VALUE_HPP

View File

@@ -0,0 +1,29 @@
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
#define BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
#include <boost/filesystem/config.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { \
namespace filesystem { \
namespace detail {
#define BOOST_UTF8_END_NAMESPACE \
} \
} \
}
#define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_BEGIN_NAMESPACE
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#endif

View File

@@ -0,0 +1,733 @@
// boost/filesystem/directory.hpp ---------------------------------------------------//
// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
// Copyright Andrey Semashev 2019
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_DIRECTORY_HPP
#define BOOST_FILESYSTEM_DIRECTORY_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/file_status.hpp>
#include <cstddef>
#include <string>
#include <vector>
#include <utility> // std::move
#include <boost/assert.hpp>
#include <boost/core/scoped_enum.hpp>
#include <boost/detail/bitmask.hpp>
#include <boost/system/error_code.hpp>
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include <boost/smart_ptr/intrusive_ref_counter.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
//--------------------------------------------------------------------------------------//
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// //
// directory_entry //
// //
//--------------------------------------------------------------------------------------//
// GCC has a problem with a member function named path within a namespace or
// sub-namespace that also has a class named path. The workaround is to always
// fully qualify the name path when it refers to the class name.
class directory_entry
{
public:
typedef boost::filesystem::path::value_type value_type; // enables class path ctor taking directory_entry
directory_entry() BOOST_NOEXCEPT {}
explicit directory_entry(boost::filesystem::path const& p) :
m_path(p), m_status(file_status()), m_symlink_status(file_status())
{
}
directory_entry(boost::filesystem::path const& p, file_status st, file_status symlink_st = file_status()) :
m_path(p), m_status(st), m_symlink_status(symlink_st)
{
}
directory_entry(directory_entry const& rhs) :
m_path(rhs.m_path), m_status(rhs.m_status), m_symlink_status(rhs.m_symlink_status)
{
}
directory_entry& operator=(directory_entry const& rhs)
{
m_path = rhs.m_path;
m_status = rhs.m_status;
m_symlink_status = rhs.m_symlink_status;
return *this;
}
// As of October 2015 the interaction between noexcept and =default is so troublesome
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
// functions. GCC is not even consistent for the same release on different platforms.
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
directory_entry(directory_entry&& rhs) BOOST_NOEXCEPT :
m_path(std::move(rhs.m_path)),
m_status(std::move(rhs.m_status)),
m_symlink_status(std::move(rhs.m_symlink_status))
{
}
directory_entry& operator=(directory_entry&& rhs) BOOST_NOEXCEPT
{
m_path = std::move(rhs.m_path);
m_status = std::move(rhs.m_status);
m_symlink_status = std::move(rhs.m_symlink_status);
return *this;
}
#endif
void assign(boost::filesystem::path const& p, file_status st = file_status(), file_status symlink_st = file_status())
{
m_path = p;
m_status = st;
m_symlink_status = symlink_st;
}
void replace_filename(boost::filesystem::path const& p, file_status st = file_status(), file_status symlink_st = file_status())
{
m_path.remove_filename();
m_path /= p;
m_status = st;
m_symlink_status = symlink_st;
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
void replace_leaf(boost::filesystem::path const& p, file_status st, file_status symlink_st)
{
replace_filename(p, st, symlink_st);
}
#endif
boost::filesystem::path const& path() const BOOST_NOEXCEPT
{
return m_path;
}
operator boost::filesystem::path const&() const BOOST_NOEXCEPT { return m_path; }
file_status status() const { return get_status(); }
file_status status(system::error_code& ec) const BOOST_NOEXCEPT { return get_status(&ec); }
file_status symlink_status() const { return get_symlink_status(); }
file_status symlink_status(system::error_code& ec) const BOOST_NOEXCEPT { return get_symlink_status(&ec); }
bool operator==(directory_entry const& rhs) const BOOST_NOEXCEPT { return m_path == rhs.m_path; }
bool operator!=(directory_entry const& rhs) const BOOST_NOEXCEPT { return m_path != rhs.m_path; }
bool operator<(directory_entry const& rhs) const BOOST_NOEXCEPT { return m_path < rhs.m_path; }
bool operator<=(directory_entry const& rhs) const BOOST_NOEXCEPT { return m_path <= rhs.m_path; }
bool operator>(directory_entry const& rhs) const BOOST_NOEXCEPT { return m_path > rhs.m_path; }
bool operator>=(directory_entry const& rhs) const BOOST_NOEXCEPT { return m_path >= rhs.m_path; }
private:
BOOST_FILESYSTEM_DECL file_status get_status(system::error_code* ec = 0) const;
BOOST_FILESYSTEM_DECL file_status get_symlink_status(system::error_code* ec = 0) const;
private:
boost::filesystem::path m_path;
mutable file_status m_status; // stat()-like
mutable file_status m_symlink_status; // lstat()-like
}; // directory_entry
//--------------------------------------------------------------------------------------//
// //
// directory_entry overloads //
// //
//--------------------------------------------------------------------------------------//
// Without these functions, calling (for example) 'is_directory' with a 'directory_entry' results in:
// - a conversion to 'path' using 'operator boost::filesystem::path const&()',
// - then a call to 'is_directory(path const& p)' which recomputes the status with 'detail::status(p)'.
//
// These functions avoid a costly recomputation of the status if one calls 'is_directory(e)' instead of 'is_directory(e.status())'
inline file_status status(directory_entry const& e)
{
return e.status();
}
inline file_status status(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return e.status(ec);
}
inline bool type_present(directory_entry const& e)
{
return filesystem::type_present(e.status());
}
inline bool type_present(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::type_present(e.status(ec));
}
inline bool status_known(directory_entry const& e)
{
return filesystem::status_known(e.status());
}
inline bool status_known(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::status_known(e.status(ec));
}
inline bool exists(directory_entry const& e)
{
return filesystem::exists(e.status());
}
inline bool exists(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::exists(e.status(ec));
}
inline bool is_regular_file(directory_entry const& e)
{
return filesystem::is_regular_file(e.status());
}
inline bool is_regular_file(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::is_regular_file(e.status(ec));
}
inline bool is_directory(directory_entry const& e)
{
return filesystem::is_directory(e.status());
}
inline bool is_directory(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::is_directory(e.status(ec));
}
inline bool is_symlink(directory_entry const& e)
{
return filesystem::is_symlink(e.symlink_status());
}
inline bool is_symlink(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::is_symlink(e.symlink_status(ec));
}
inline bool is_other(directory_entry const& e)
{
return filesystem::is_other(e.status());
}
inline bool is_other(directory_entry const& e, system::error_code& ec) BOOST_NOEXCEPT
{
return filesystem::is_other(e.status(ec));
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool is_regular(directory_entry const& e)
{
return filesystem::is_regular(e.status());
}
#endif
//--------------------------------------------------------------------------------------//
// //
// directory_iterator helpers //
// //
//--------------------------------------------------------------------------------------//
BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(directory_options, unsigned int)
{
none = 0u,
skip_permission_denied = 1u, // if a directory cannot be opened because of insufficient permissions, pretend that the directory is empty
follow_directory_symlink = 1u << 1, // recursive_directory_iterator: follow directory symlinks
skip_dangling_symlinks = 1u << 2, // non-standard extension for recursive_directory_iterator: don't follow dangling directory symlinks,
pop_on_error = 1u << 3, // non-standard extension for recursive_directory_iterator: instead of producing an end iterator on errors,
// repeatedly invoke pop() until it succeeds or the iterator becomes equal to end iterator
_detail_no_follow = 1u << 4, // internal use only
_detail_no_push = 1u << 5 // internal use only
}
BOOST_SCOPED_ENUM_DECLARE_END(directory_options)
BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(directory_options))
class directory_iterator;
namespace detail {
struct dir_itr_imp :
public boost::intrusive_ref_counter< dir_itr_imp >
{
#ifdef BOOST_WINDOWS_API
unsigned char extra_data_format;
std::size_t current_offset;
#endif
directory_entry dir_entry;
void* handle;
dir_itr_imp() BOOST_NOEXCEPT :
#ifdef BOOST_WINDOWS_API
extra_data_format(0u),
current_offset(0u),
#endif
handle(NULL)
{
}
BOOST_FILESYSTEM_DECL ~dir_itr_imp() BOOST_NOEXCEPT;
BOOST_FILESYSTEM_DECL static void* operator new(std::size_t class_size, std::size_t extra_size) BOOST_NOEXCEPT;
BOOST_FILESYSTEM_DECL static void operator delete(void* p, std::size_t extra_size) BOOST_NOEXCEPT;
BOOST_FILESYSTEM_DECL static void operator delete(void* p) BOOST_NOEXCEPT;
};
BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, path const& p, unsigned int opts, system::error_code* ec);
BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, system::error_code* ec);
} // namespace detail
//--------------------------------------------------------------------------------------//
// //
// directory_iterator //
// //
//--------------------------------------------------------------------------------------//
class directory_iterator :
public boost::iterator_facade<
directory_iterator,
directory_entry,
boost::single_pass_traversal_tag
>
{
friend class boost::iterator_core_access;
friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, path const& p, unsigned int opts, system::error_code* ec);
friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, system::error_code* ec);
public:
directory_iterator() BOOST_NOEXCEPT {} // creates the "end" iterator
// iterator_facade derived classes don't seem to like implementations in
// separate translation unit dll's, so forward to detail functions
explicit directory_iterator(path const& p, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts = directory_options::none)
{
detail::directory_iterator_construct(*this, p, static_cast< unsigned int >(opts), 0);
}
directory_iterator(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
detail::directory_iterator_construct(*this, p, static_cast< unsigned int >(directory_options::none), &ec);
}
directory_iterator(path const& p, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts, system::error_code& ec) BOOST_NOEXCEPT
{
detail::directory_iterator_construct(*this, p, static_cast< unsigned int >(opts), &ec);
}
BOOST_DEFAULTED_FUNCTION(directory_iterator(directory_iterator const& that), : m_imp(that.m_imp) {})
BOOST_DEFAULTED_FUNCTION(directory_iterator& operator=(directory_iterator const& that), { m_imp = that.m_imp; return *this; })
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
directory_iterator(directory_iterator&& that) BOOST_NOEXCEPT :
m_imp(std::move(that.m_imp))
{
}
directory_iterator& operator=(directory_iterator&& that) BOOST_NOEXCEPT
{
m_imp = std::move(that.m_imp);
return *this;
}
#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
directory_iterator& increment(system::error_code& ec) BOOST_NOEXCEPT
{
detail::directory_iterator_increment(*this, &ec);
return *this;
}
private:
boost::iterator_facade<
directory_iterator,
directory_entry,
boost::single_pass_traversal_tag
>::reference dereference() const
{
BOOST_ASSERT_MSG(!is_end(), "attempt to dereference end directory iterator");
return m_imp->dir_entry;
}
void increment() { detail::directory_iterator_increment(*this, 0); }
bool equal(directory_iterator const& rhs) const BOOST_NOEXCEPT
{
return m_imp == rhs.m_imp || (is_end() && rhs.is_end());
}
bool is_end() const BOOST_NOEXCEPT
{
// Note: The check for handle is needed because the iterator can be copied and the copy
// can be incremented to end while the original iterator still refers to the same dir_itr_imp.
return !m_imp || !m_imp->handle;
}
private:
// intrusive_ptr provides the shallow-copy semantics required for single pass iterators
// (i.e. InputIterators). The end iterator is indicated by is_end().
boost::intrusive_ptr< detail::dir_itr_imp > m_imp;
};
// enable directory_iterator C++11 range-based for statement use --------------------//
// begin() and end() are only used by a range-based for statement in the context of
// auto - thus the top-level const is stripped - so returning const is harmless and
// emphasizes begin() is just a pass through.
inline directory_iterator const& begin(directory_iterator const& iter) BOOST_NOEXCEPT
{
return iter;
}
inline directory_iterator end(directory_iterator const&) BOOST_NOEXCEPT
{
return directory_iterator();
}
// enable C++14 generic accessors for range const iterators
inline directory_iterator const& cbegin(directory_iterator const& iter) BOOST_NOEXCEPT
{
return iter;
}
inline directory_iterator cend(directory_iterator const&) BOOST_NOEXCEPT
{
return directory_iterator();
}
// enable directory_iterator BOOST_FOREACH -----------------------------------------//
inline directory_iterator& range_begin(directory_iterator& iter) BOOST_NOEXCEPT
{
return iter;
}
inline directory_iterator range_begin(directory_iterator const& iter) BOOST_NOEXCEPT
{
return iter;
}
inline directory_iterator range_end(directory_iterator&) BOOST_NOEXCEPT
{
return directory_iterator();
}
inline directory_iterator range_end(directory_iterator const&) BOOST_NOEXCEPT
{
return directory_iterator();
}
} // namespace filesystem
// namespace boost template specializations
template< typename C, typename Enabler >
struct range_mutable_iterator;
template<>
struct range_mutable_iterator< boost::filesystem::directory_iterator, void >
{
typedef boost::filesystem::directory_iterator type;
};
template< typename C, typename Enabler >
struct range_const_iterator;
template<>
struct range_const_iterator< boost::filesystem::directory_iterator, void >
{
typedef boost::filesystem::directory_iterator type;
};
namespace filesystem {
//--------------------------------------------------------------------------------------//
// //
// recursive_directory_iterator helpers //
// //
//--------------------------------------------------------------------------------------//
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
// Deprecated enum, use directory_options instead
BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(symlink_option, unsigned int)
{
none = static_cast< unsigned int >(directory_options::none),
no_recurse = none, // don't follow directory symlinks (default behavior)
recurse = static_cast< unsigned int >(directory_options::follow_directory_symlink), // follow directory symlinks
_detail_no_push = static_cast< unsigned int >(directory_options::_detail_no_push) // internal use only
}
BOOST_SCOPED_ENUM_DECLARE_END(symlink_option)
BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(symlink_option))
#endif // BOOST_FILESYSTEM_NO_DEPRECATED
class recursive_directory_iterator;
namespace detail {
struct recur_dir_itr_imp :
public boost::intrusive_ref_counter< recur_dir_itr_imp >
{
typedef directory_iterator element_type;
std::vector< element_type > m_stack;
// directory_options values, declared as unsigned int for ABI compatibility
unsigned int m_options;
explicit recur_dir_itr_imp(unsigned int opts) BOOST_NOEXCEPT : m_options(opts) {}
};
BOOST_FILESYSTEM_DECL void recursive_directory_iterator_construct(recursive_directory_iterator& it, path const& dir_path, unsigned int opts, system::error_code* ec);
BOOST_FILESYSTEM_DECL void recursive_directory_iterator_increment(recursive_directory_iterator& it, system::error_code* ec);
BOOST_FILESYSTEM_DECL void recursive_directory_iterator_pop(recursive_directory_iterator& it, system::error_code* ec);
} // namespace detail
//--------------------------------------------------------------------------------------//
// //
// recursive_directory_iterator //
// //
//--------------------------------------------------------------------------------------//
class recursive_directory_iterator :
public boost::iterator_facade<
recursive_directory_iterator,
directory_entry,
boost::single_pass_traversal_tag
>
{
friend class boost::iterator_core_access;
friend BOOST_FILESYSTEM_DECL void detail::recursive_directory_iterator_construct(recursive_directory_iterator& it, path const& dir_path, unsigned int opts, system::error_code* ec);
friend BOOST_FILESYSTEM_DECL void detail::recursive_directory_iterator_increment(recursive_directory_iterator& it, system::error_code* ec);
friend BOOST_FILESYSTEM_DECL void detail::recursive_directory_iterator_pop(recursive_directory_iterator& it, system::error_code* ec);
public:
recursive_directory_iterator() BOOST_NOEXCEPT {} // creates the "end" iterator
explicit recursive_directory_iterator(path const& dir_path)
{
detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(directory_options::none), 0);
}
recursive_directory_iterator(path const& dir_path, system::error_code& ec)
{
detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(directory_options::none), &ec);
}
recursive_directory_iterator(path const& dir_path, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts)
{
detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), 0);
}
recursive_directory_iterator(path const& dir_path, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts, system::error_code& ec)
{
detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), &ec);
}
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
// Deprecated constructors
recursive_directory_iterator(path const& dir_path, BOOST_SCOPED_ENUM_NATIVE(symlink_option) opts)
{
detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), 0);
}
recursive_directory_iterator(path const& dir_path, BOOST_SCOPED_ENUM_NATIVE(symlink_option) opts, system::error_code& ec) BOOST_NOEXCEPT
{
detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), &ec);
}
#endif // BOOST_FILESYSTEM_NO_DEPRECATED
BOOST_DEFAULTED_FUNCTION(recursive_directory_iterator(recursive_directory_iterator const& that), : m_imp(that.m_imp) {})
BOOST_DEFAULTED_FUNCTION(recursive_directory_iterator& operator=(recursive_directory_iterator const& that), { m_imp = that.m_imp; return *this; })
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
recursive_directory_iterator(recursive_directory_iterator&& that) BOOST_NOEXCEPT :
m_imp(std::move(that.m_imp))
{
}
recursive_directory_iterator& operator=(recursive_directory_iterator&& that) BOOST_NOEXCEPT
{
m_imp = std::move(that.m_imp);
return *this;
}
#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
recursive_directory_iterator& increment(system::error_code& ec) BOOST_NOEXCEPT
{
detail::recursive_directory_iterator_increment(*this, &ec);
return *this;
}
int depth() const BOOST_NOEXCEPT
{
BOOST_ASSERT_MSG(!is_end(), "depth() on end recursive_directory_iterator");
return static_cast< int >(m_imp->m_stack.size() - 1u);
}
bool recursion_pending() const BOOST_NOEXCEPT
{
BOOST_ASSERT_MSG(!is_end(), "recursion_pending() on end recursive_directory_iterator");
return (m_imp->m_options & static_cast< unsigned int >(directory_options::_detail_no_push)) == 0u;
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
int level() const BOOST_NOEXCEPT
{
return depth();
}
bool no_push_pending() const BOOST_NOEXCEPT { return !recursion_pending(); }
bool no_push_request() const BOOST_NOEXCEPT { return !recursion_pending(); }
#endif
void pop()
{
detail::recursive_directory_iterator_pop(*this, 0);
}
void pop(system::error_code& ec) BOOST_NOEXCEPT
{
detail::recursive_directory_iterator_pop(*this, &ec);
}
void disable_recursion_pending(bool value = true) BOOST_NOEXCEPT
{
BOOST_ASSERT_MSG(!is_end(), "disable_recursion_pending() on end recursive_directory_iterator");
if (value)
m_imp->m_options |= static_cast< unsigned int >(directory_options::_detail_no_push);
else
m_imp->m_options &= ~static_cast< unsigned int >(directory_options::_detail_no_push);
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
void no_push(bool value = true) BOOST_NOEXCEPT
{
disable_recursion_pending(value);
}
#endif
file_status status() const
{
BOOST_ASSERT_MSG(!is_end(), "status() on end recursive_directory_iterator");
return m_imp->m_stack.back()->status();
}
file_status symlink_status() const
{
BOOST_ASSERT_MSG(!is_end(), "symlink_status() on end recursive_directory_iterator");
return m_imp->m_stack.back()->symlink_status();
}
private:
boost::iterator_facade<
recursive_directory_iterator,
directory_entry,
boost::single_pass_traversal_tag
>::reference dereference() const
{
BOOST_ASSERT_MSG(!is_end(), "dereference of end recursive_directory_iterator");
return *m_imp->m_stack.back();
}
void increment() { detail::recursive_directory_iterator_increment(*this, 0); }
bool equal(recursive_directory_iterator const& rhs) const BOOST_NOEXCEPT
{
return m_imp == rhs.m_imp || (is_end() && rhs.is_end());
}
bool is_end() const BOOST_NOEXCEPT
{
// Note: The check for m_stack.empty() is needed because the iterator can be copied and the copy
// can be incremented to end while the original iterator still refers to the same recur_dir_itr_imp.
return !m_imp || m_imp->m_stack.empty();
}
private:
// intrusive_ptr provides the shallow-copy semantics required for single pass iterators
// (i.e. InputIterators). The end iterator is indicated by is_end().
boost::intrusive_ptr< detail::recur_dir_itr_imp > m_imp;
};
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
typedef recursive_directory_iterator wrecursive_directory_iterator;
#endif
// enable recursive directory iterator C++11 range-base for statement use ----------//
// begin() and end() are only used by a range-based for statement in the context of
// auto - thus the top-level const is stripped - so returning const is harmless and
// emphasizes begin() is just a pass through.
inline recursive_directory_iterator const& begin(recursive_directory_iterator const& iter) BOOST_NOEXCEPT
{
return iter;
}
inline recursive_directory_iterator end(recursive_directory_iterator const&) BOOST_NOEXCEPT
{
return recursive_directory_iterator();
}
// enable C++14 generic accessors for range const iterators
inline recursive_directory_iterator const& cbegin(recursive_directory_iterator const& iter) BOOST_NOEXCEPT
{
return iter;
}
inline recursive_directory_iterator cend(recursive_directory_iterator const&) BOOST_NOEXCEPT
{
return recursive_directory_iterator();
}
// enable recursive directory iterator BOOST_FOREACH -------------------------------//
inline recursive_directory_iterator& range_begin(recursive_directory_iterator& iter) BOOST_NOEXCEPT
{
return iter;
}
inline recursive_directory_iterator range_begin(recursive_directory_iterator const& iter) BOOST_NOEXCEPT
{
return iter;
}
inline recursive_directory_iterator range_end(recursive_directory_iterator&) BOOST_NOEXCEPT
{
return recursive_directory_iterator();
}
inline recursive_directory_iterator range_end(recursive_directory_iterator const&) BOOST_NOEXCEPT
{
return recursive_directory_iterator();
}
} // namespace filesystem
// namespace boost template specializations
template<>
struct range_mutable_iterator< boost::filesystem::recursive_directory_iterator, void >
{
typedef boost::filesystem::recursive_directory_iterator type;
};
template<>
struct range_const_iterator< boost::filesystem::recursive_directory_iterator, void >
{
typedef boost::filesystem::recursive_directory_iterator type;
};
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_DIRECTORY_HPP

View File

@@ -0,0 +1,92 @@
// boost/filesystem/exception.hpp -----------------------------------------------------//
// Copyright Beman Dawes 2003
// Copyright Andrey Semashev 2019
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#ifndef BOOST_FILESYSTEM_EXCEPTION_HPP
#define BOOST_FILESYSTEM_EXCEPTION_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <string>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include <boost/smart_ptr/intrusive_ref_counter.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// //
// class filesystem_error //
// //
//--------------------------------------------------------------------------------------//
class BOOST_SYMBOL_VISIBLE filesystem_error :
public system::system_error
{
// see http://www.boost.org/more/error_handling.html for design rationale
public:
BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
BOOST_FILESYSTEM_DECL filesystem_error(filesystem_error const& that);
BOOST_FILESYSTEM_DECL filesystem_error& operator=(filesystem_error const& that);
BOOST_FILESYSTEM_DECL ~filesystem_error() BOOST_NOEXCEPT_OR_NOTHROW;
path const& path1() const BOOST_NOEXCEPT
{
return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path();
}
path const& path2() const BOOST_NOEXCEPT
{
return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path();
}
BOOST_FILESYSTEM_DECL const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
private:
BOOST_FILESYSTEM_DECL static path const& get_empty_path() BOOST_NOEXCEPT;
private:
struct impl :
public boost::intrusive_ref_counter< impl >
{
path m_path1; // may be empty()
path m_path2; // may be empty()
std::string m_what; // not built until needed
BOOST_DEFAULTED_FUNCTION(impl(), {})
explicit impl(path const& path1) :
m_path1(path1)
{
}
impl(path const& path1, path const& path2) :
m_path1(path1), m_path2(path2)
{
}
};
boost::intrusive_ptr< impl > m_imp_ptr;
};
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_EXCEPTION_HPP

View File

@@ -0,0 +1,243 @@
// boost/filesystem/file_status.hpp --------------------------------------------------//
// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
// Copyright Andrey Semashev 2019
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_FILE_STATUS_HPP
#define BOOST_FILESYSTEM_FILE_STATUS_HPP
#include <boost/filesystem/config.hpp>
#include <boost/detail/bitmask.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
//--------------------------------------------------------------------------------------//
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// file_type //
//--------------------------------------------------------------------------------------//
enum file_type
{
status_error,
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
status_unknown = status_error,
#endif
file_not_found,
regular_file,
directory_file,
// the following may not apply to some operating systems or file systems
symlink_file,
block_file,
character_file,
fifo_file,
socket_file,
reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink
type_unknown // file does exist, but isn't one of the above types or
// we don't have strong enough permission to find its type
};
//--------------------------------------------------------------------------------------//
// perms //
//--------------------------------------------------------------------------------------//
enum perms
{
no_perms = 0, // file_not_found is no_perms rather than perms_not_known
// POSIX equivalent macros given in comments.
// Values are from POSIX and are given in octal per the POSIX standard.
// permission bits
owner_read = 0400, // S_IRUSR, Read permission, owner
owner_write = 0200, // S_IWUSR, Write permission, owner
owner_exe = 0100, // S_IXUSR, Execute/search permission, owner
owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner
group_read = 040, // S_IRGRP, Read permission, group
group_write = 020, // S_IWGRP, Write permission, group
group_exe = 010, // S_IXGRP, Execute/search permission, group
group_all = 070, // S_IRWXG, Read, write, execute/search by group
others_read = 04, // S_IROTH, Read permission, others
others_write = 02, // S_IWOTH, Write permission, others
others_exe = 01, // S_IXOTH, Execute/search permission, others
others_all = 07, // S_IRWXO, Read, write, execute/search by others
all_all = 0777, // owner_all|group_all|others_all
// other POSIX bits
set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
sticky_bit = 01000, // S_ISVTX,
// (POSIX XSI) On directories, restricted deletion flag
// (V7) 'sticky bit': save swapped text even after use
// (SunOS) On non-directories: don't cache this file
// (SVID-v4.2) On directories: restricted deletion flag
// Also see http://en.wikipedia.org/wiki/Sticky_bit
perms_mask = 07777, // all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit
perms_not_known = 0xFFFF, // present when directory_entry cache not loaded
// options for permissions() function
add_perms = 0x1000, // adds the given permission bits to the current bits
remove_perms = 0x2000, // removes the given permission bits from the current bits;
// choose add_perms or remove_perms, not both; if neither add_perms
// nor remove_perms is given, replace the current bits with
// the given bits.
symlink_perms = 0x4000, // on POSIX, don't resolve symlinks; implied on Windows
// BOOST_BITMASK op~ casts to int32_least_t, producing invalid enum values
_detail_extend_perms_32_1 = 0x7fffffff,
_detail_extend_perms_32_2 = -0x7fffffff - 1
};
BOOST_BITMASK(perms)
//--------------------------------------------------------------------------------------//
// file_status //
//--------------------------------------------------------------------------------------//
class file_status
{
public:
BOOST_CONSTEXPR file_status() BOOST_NOEXCEPT :
m_value(status_error),
m_perms(perms_not_known)
{
}
explicit BOOST_CONSTEXPR file_status(file_type v) BOOST_NOEXCEPT :
m_value(v),
m_perms(perms_not_known)
{
}
BOOST_CONSTEXPR file_status(file_type v, perms prms) BOOST_NOEXCEPT :
m_value(v),
m_perms(prms)
{
}
// As of October 2015 the interaction between noexcept and =default is so troublesome
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
// functions. GCC is not even consistent for the same release on different platforms.
BOOST_CONSTEXPR file_status(const file_status& rhs) BOOST_NOEXCEPT :
m_value(rhs.m_value),
m_perms(rhs.m_perms)
{
}
BOOST_CXX14_CONSTEXPR file_status& operator=(const file_status& rhs) BOOST_NOEXCEPT
{
m_value = rhs.m_value;
m_perms = rhs.m_perms;
return *this;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
// Note: std::move is not constexpr in C++11, that's why we're not using it here
BOOST_CONSTEXPR file_status(file_status&& rhs) BOOST_NOEXCEPT :
m_value(static_cast< file_type&& >(rhs.m_value)),
m_perms(static_cast< enum perms&& >(rhs.m_perms))
{
}
BOOST_CXX14_CONSTEXPR file_status& operator=(file_status&& rhs) BOOST_NOEXCEPT
{
m_value = static_cast< file_type&& >(rhs.m_value);
m_perms = static_cast< enum perms&& >(rhs.m_perms);
return *this;
}
#endif
// observers
BOOST_CONSTEXPR file_type type() const BOOST_NOEXCEPT { return m_value; }
BOOST_CONSTEXPR perms permissions() const BOOST_NOEXCEPT { return m_perms; }
// modifiers
BOOST_CXX14_CONSTEXPR void type(file_type v) BOOST_NOEXCEPT { m_value = v; }
BOOST_CXX14_CONSTEXPR void permissions(perms prms) BOOST_NOEXCEPT { m_perms = prms; }
BOOST_CONSTEXPR bool operator==(const file_status& rhs) const BOOST_NOEXCEPT
{
return type() == rhs.type() && permissions() == rhs.permissions();
}
BOOST_CONSTEXPR bool operator!=(const file_status& rhs) const BOOST_NOEXCEPT
{
return !(*this == rhs);
}
private:
file_type m_value;
enum perms m_perms;
};
inline BOOST_CONSTEXPR bool type_present(file_status f) BOOST_NOEXCEPT
{
return f.type() != status_error;
}
inline BOOST_CONSTEXPR bool permissions_present(file_status f) BOOST_NOEXCEPT
{
return f.permissions() != perms_not_known;
}
inline BOOST_CONSTEXPR bool status_known(file_status f) BOOST_NOEXCEPT
{
return filesystem::type_present(f) && filesystem::permissions_present(f);
}
inline BOOST_CONSTEXPR bool exists(file_status f) BOOST_NOEXCEPT
{
return f.type() != status_error && f.type() != file_not_found;
}
inline BOOST_CONSTEXPR bool is_regular_file(file_status f) BOOST_NOEXCEPT
{
return f.type() == regular_file;
}
inline BOOST_CONSTEXPR bool is_directory(file_status f) BOOST_NOEXCEPT
{
return f.type() == directory_file;
}
inline BOOST_CONSTEXPR bool is_symlink(file_status f) BOOST_NOEXCEPT
{
return f.type() == symlink_file;
}
inline BOOST_CONSTEXPR bool is_other(file_status f) BOOST_NOEXCEPT
{
return filesystem::exists(f) && !filesystem::is_regular_file(f) && !filesystem::is_directory(f) && !filesystem::is_symlink(f);
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool is_regular(file_status f) BOOST_NOEXCEPT
{
return filesystem::is_regular_file(f);
}
#endif
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp> // pops abi_prefix.hpp pragmas
#endif // BOOST_FILESYSTEM_FILE_STATUS_HPP

View File

@@ -0,0 +1,206 @@
// boost/filesystem/fstream.hpp ------------------------------------------------------//
// Copyright Beman Dawes 2002
// Copyright Andrey Semashev 2021
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_FSTREAM_HPP
#define BOOST_FILESYSTEM_FSTREAM_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <iosfwd>
#include <fstream>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
#if defined(BOOST_WINDOWS_API)
// On Windows, except for standard libaries known to have wchar_t overloads for
// file stream I/O, use path::string() to get a narrow character c_str()
#if (defined(_CPPLIB_VER) && _CPPLIB_VER >= 405 && !defined(_STLPORT_VERSION)) || \
(defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 7000 && defined(_LIBCPP_HAS_OPEN_WITH_WCHAR))
// Use wide characters directly
// Note: We don't use C++17 std::filesystem::path as a means to pass wide paths
// to file streams because of various problems:
// - std::filesystem is available in gcc 8 but it is broken there (fails to compile path definition
// on Windows). Compilation errors seem to be fixed since gcc 9.
// - In gcc 10.2 and clang 8.0.1 on Cygwin64, the path attempts to convert the wide string to narrow
// and fails in runtime. This may be system locale dependent, and performing character code conversion
// is against the purpose of using std::filesystem::path anyway.
// - Other std::filesystem implementations were not tested, so it is not known if they actually work
// with wide paths.
#define BOOST_FILESYSTEM_C_STR(p) p.c_str()
#else
// Use narrow characters, since wide not available
#define BOOST_FILESYSTEM_C_STR(p) p.string().c_str()
#endif
#endif // defined(BOOST_WINDOWS_API)
#if !defined(BOOST_FILESYSTEM_C_STR)
#define BOOST_FILESYSTEM_C_STR(p) p.c_str()
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
// 'boost::filesystem::basic_fstream<charT>' : inherits 'std::basic_istream<_Elem,_Traits>::std::basic_istream<_Elem,_Traits>::_Add_vtordisp1' via dominance
#pragma warning(disable : 4250)
#endif
namespace boost {
namespace filesystem {
//--------------------------------------------------------------------------------------//
// basic_filebuf //
//--------------------------------------------------------------------------------------//
template< class charT, class traits = std::char_traits< charT > >
class basic_filebuf :
public std::basic_filebuf< charT, traits >
{
public:
BOOST_DEFAULTED_FUNCTION(basic_filebuf(), {})
BOOST_DELETED_FUNCTION(basic_filebuf(basic_filebuf const&))
BOOST_DELETED_FUNCTION(basic_filebuf const& operator=(basic_filebuf const&))
public:
basic_filebuf< charT, traits >* open(path const& p, std::ios_base::openmode mode)
{
return std::basic_filebuf< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : 0;
}
};
//--------------------------------------------------------------------------------------//
// basic_ifstream //
//--------------------------------------------------------------------------------------//
template< class charT, class traits = std::char_traits< charT > >
class basic_ifstream :
public std::basic_ifstream< charT, traits >
{
public:
BOOST_DEFAULTED_FUNCTION(basic_ifstream(), {})
// use two signatures, rather than one signature with default second
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
explicit basic_ifstream(path const& p) :
std::basic_ifstream< charT, traits >(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in) {}
basic_ifstream(path const& p, std::ios_base::openmode mode) :
std::basic_ifstream< charT, traits >(BOOST_FILESYSTEM_C_STR(p), mode) {}
BOOST_DELETED_FUNCTION(basic_ifstream(basic_ifstream const&))
BOOST_DELETED_FUNCTION(basic_ifstream const& operator=(basic_ifstream const&))
public:
void open(path const& p)
{
std::basic_ifstream< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in);
}
void open(path const& p, std::ios_base::openmode mode)
{
std::basic_ifstream< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode);
}
};
//--------------------------------------------------------------------------------------//
// basic_ofstream //
//--------------------------------------------------------------------------------------//
template< class charT, class traits = std::char_traits< charT > >
class basic_ofstream :
public std::basic_ofstream< charT, traits >
{
public:
BOOST_DEFAULTED_FUNCTION(basic_ofstream(), {})
// use two signatures, rather than one signature with default second
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
explicit basic_ofstream(path const& p) :
std::basic_ofstream< charT, traits >(BOOST_FILESYSTEM_C_STR(p), std::ios_base::out) {}
basic_ofstream(path const& p, std::ios_base::openmode mode) :
std::basic_ofstream< charT, traits >(BOOST_FILESYSTEM_C_STR(p), mode) {}
BOOST_DELETED_FUNCTION(basic_ofstream(basic_ofstream const&))
BOOST_DELETED_FUNCTION(basic_ofstream const& operator=(basic_ofstream const&))
public:
void open(path const& p)
{
std::basic_ofstream< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), std::ios_base::out);
}
void open(path const& p, std::ios_base::openmode mode)
{
std::basic_ofstream< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode);
}
};
//--------------------------------------------------------------------------------------//
// basic_fstream //
//--------------------------------------------------------------------------------------//
template< class charT, class traits = std::char_traits< charT > >
class basic_fstream :
public std::basic_fstream< charT, traits >
{
public:
BOOST_DEFAULTED_FUNCTION(basic_fstream(), {})
// use two signatures, rather than one signature with default second
// argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)
explicit basic_fstream(path const& p) :
std::basic_fstream< charT, traits >(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in | std::ios_base::out) {}
basic_fstream(path const& p, std::ios_base::openmode mode) :
std::basic_fstream< charT, traits >(BOOST_FILESYSTEM_C_STR(p), mode) {}
BOOST_DELETED_FUNCTION(basic_fstream(basic_fstream const&))
BOOST_DELETED_FUNCTION(basic_fstream const& operator=(basic_fstream const&))
public:
void open(path const& p)
{
std::basic_fstream< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), std::ios_base::in | std::ios_base::out);
}
void open(path const& p, std::ios_base::openmode mode)
{
std::basic_fstream< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode);
}
};
//--------------------------------------------------------------------------------------//
// typedefs //
//--------------------------------------------------------------------------------------//
typedef basic_filebuf< char > filebuf;
typedef basic_ifstream< char > ifstream;
typedef basic_ofstream< char > ofstream;
typedef basic_fstream< char > fstream;
typedef basic_filebuf< wchar_t > wfilebuf;
typedef basic_ifstream< wchar_t > wifstream;
typedef basic_ofstream< wchar_t > wofstream;
typedef basic_fstream< wchar_t > wfstream;
} // namespace filesystem
} // namespace boost
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_FSTREAM_HPP

View File

@@ -0,0 +1,719 @@
// boost/filesystem/operations.hpp ---------------------------------------------------//
// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
// Copyright Andrey Semashev 2020-2021
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_OPERATIONS_HPP
#define BOOST_FILESYSTEM_OPERATIONS_HPP
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/file_status.hpp>
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
// These includes are left for backward compatibility and should be included directly by users, as needed
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/directory.hpp>
#endif
#include <boost/detail/bitmask.hpp>
#include <boost/core/scoped_enum.hpp>
#include <boost/system/error_code.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <ctime>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
//--------------------------------------------------------------------------------------//
namespace boost {
namespace filesystem {
struct space_info
{
// all values are byte counts
boost::uintmax_t capacity;
boost::uintmax_t free; // <= capacity
boost::uintmax_t available; // <= free
};
BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(copy_options, unsigned int)
{
none = 0u, // Default. For copy_file: error if the target file exists. For copy: do not recurse, follow symlinks, copy file contents.
// copy_file options:
skip_existing = 1u, // Don't overwrite the existing target file, don't report an error
overwrite_existing = 1u << 1, // Overwrite existing file
update_existing = 1u << 2, // Overwrite existing file if its last write time is older than the replacement file
synchronize_data = 1u << 3, // Flush all buffered data written to the target file to permanent storage
synchronize = 1u << 4, // Flush all buffered data and attributes written to the target file to permanent storage
// copy options:
recursive = 1u << 8, // Recurse into sub-directories
copy_symlinks = 1u << 9, // Copy symlinks as symlinks instead of copying the referenced file
skip_symlinks = 1u << 10, // Don't copy symlinks
directories_only = 1u << 11, // Only copy directory structure, do not copy non-directory files
create_symlinks = 1u << 12, // Create symlinks instead of copying files
create_hard_links = 1u << 13, // Create hard links instead of copying files
_detail_recursing = 1u << 14 // Internal use only, do not use
}
BOOST_SCOPED_ENUM_DECLARE_END(copy_options)
BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(copy_options))
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
BOOST_SCOPED_ENUM_DECLARE_BEGIN(copy_option)
{
none = static_cast< unsigned int >(copy_options::none),
fail_if_exists = none,
overwrite_if_exists = static_cast< unsigned int >(copy_options::overwrite_existing)
}
BOOST_SCOPED_ENUM_DECLARE_END(copy_option)
#endif
//--------------------------------------------------------------------------------------//
// implementation details //
//--------------------------------------------------------------------------------------//
namespace detail {
BOOST_FILESYSTEM_DECL
path absolute(path const& p, path const& base, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
file_status status(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
file_status symlink_status(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
bool is_empty(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path initial_path(system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path canonical(path const& p, path const& base, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = 0);
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
BOOST_FILESYSTEM_DECL
void copy_directory(path const& from, path const& to, system::error_code* ec = 0);
#endif
BOOST_FILESYSTEM_DECL
bool copy_file(path const& from, path const& to, // See ticket #2925
unsigned int options, system::error_code* ec = 0); // see copy_options for options
BOOST_FILESYSTEM_DECL
void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
bool create_directories(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
bool create_directory(path const& p, const path* existing, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void create_directory_symlink(path const& to, path const& from, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void create_hard_link(path const& to, path const& from, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void create_symlink(path const& to, path const& from, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path current_path(system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void current_path(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
bool equivalent(path const& p1, path const& p2, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
boost::uintmax_t file_size(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
std::time_t creation_time(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
std::time_t last_write_time(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void permissions(path const& p, perms prms, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path read_symlink(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path relative(path const& p, path const& base, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
bool remove(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
boost::uintmax_t remove_all(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void rename(path const& old_p, path const& new_p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
void resize_file(path const& p, uintmax_t size, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
space_info space(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path system_complete(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path temp_directory_path(system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path unique_path(path const& p, system::error_code* ec = 0);
BOOST_FILESYSTEM_DECL
path weakly_canonical(path const& p, path const& base, system::error_code* ec = 0);
} // namespace detail
//--------------------------------------------------------------------------------------//
// //
// status query functions //
// //
//--------------------------------------------------------------------------------------//
inline file_status status(path const& p)
{
return detail::status(p);
}
inline file_status status(path const& p, system::error_code& ec)
{
return detail::status(p, &ec);
}
inline file_status symlink_status(path const& p)
{
return detail::symlink_status(p);
}
inline file_status symlink_status(path const& p, system::error_code& ec)
{
return detail::symlink_status(p, &ec);
}
inline bool exists(path const& p)
{
return exists(detail::status(p));
}
inline bool exists(path const& p, system::error_code& ec)
{
return exists(detail::status(p, &ec));
}
inline bool is_directory(path const& p)
{
return is_directory(detail::status(p));
}
inline bool is_directory(path const& p, system::error_code& ec)
{
return is_directory(detail::status(p, &ec));
}
inline bool is_regular_file(path const& p)
{
return is_regular_file(detail::status(p));
}
inline bool is_regular_file(path const& p, system::error_code& ec)
{
return is_regular_file(detail::status(p, &ec));
}
inline bool is_other(path const& p)
{
return is_other(detail::status(p));
}
inline bool is_other(path const& p, system::error_code& ec)
{
return is_other(detail::status(p, &ec));
}
inline bool is_symlink(path const& p)
{
return is_symlink(detail::symlink_status(p));
}
inline bool is_symlink(path const& p, system::error_code& ec)
{
return is_symlink(detail::symlink_status(p, &ec));
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool is_regular(path const& p)
{
return is_regular(detail::status(p));
}
inline bool is_regular(path const& p, system::error_code& ec)
{
return is_regular(detail::status(p, &ec));
}
#endif
inline bool is_empty(path const& p)
{
return detail::is_empty(p);
}
inline bool is_empty(path const& p, system::error_code& ec)
{
return detail::is_empty(p, &ec);
}
//--------------------------------------------------------------------------------------//
// //
// operational functions //
// //
//--------------------------------------------------------------------------------------//
inline path initial_path()
{
return detail::initial_path();
}
inline path initial_path(system::error_code& ec)
{
return detail::initial_path(&ec);
}
template< class Path >
path initial_path()
{
return initial_path();
}
template< class Path >
path initial_path(system::error_code& ec)
{
return detail::initial_path(&ec);
}
inline path current_path()
{
return detail::current_path();
}
inline path current_path(system::error_code& ec)
{
return detail::current_path(&ec);
}
inline void current_path(path const& p)
{
detail::current_path(p);
}
inline void current_path(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
detail::current_path(p, &ec);
}
inline path absolute(path const& p, path const& base = current_path())
{
return detail::absolute(p, base);
}
inline path absolute(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return detail::absolute(p, base, &ec);
}
inline path absolute(path const& p, path const& base, system::error_code& ec)
{
return detail::absolute(p, base, &ec);
}
inline path canonical(path const& p, path const& base = current_path())
{
return detail::canonical(p, base);
}
inline path canonical(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return detail::canonical(p, base, &ec);
}
inline path canonical(path const& p, path const& base, system::error_code& ec)
{
return detail::canonical(p, base, &ec);
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline path complete(path const& p)
{
return absolute(p, initial_path());
}
inline path complete(path const& p, path const& base)
{
return absolute(p, base);
}
#endif
inline void copy(path const& from, path const& to)
{
detail::copy(from, to, static_cast< unsigned int >(copy_options::none));
}
inline void copy(path const& from, path const& to, system::error_code& ec) BOOST_NOEXCEPT
{
detail::copy(from, to, static_cast< unsigned int >(copy_options::none), &ec);
}
inline void copy(path const& from, path const& to, BOOST_SCOPED_ENUM_NATIVE(copy_options) options)
{
detail::copy(from, to, static_cast< unsigned int >(options));
}
inline void copy(path const& from, path const& to, BOOST_SCOPED_ENUM_NATIVE(copy_options) options, system::error_code& ec) BOOST_NOEXCEPT
{
detail::copy(from, to, static_cast< unsigned int >(options), &ec);
}
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
inline void copy_directory(path const& from, path const& to)
{
detail::copy_directory(from, to);
}
inline void copy_directory(path const& from, path const& to, system::error_code& ec) BOOST_NOEXCEPT
{
detail::copy_directory(from, to, &ec);
}
#endif
inline bool copy_file(path const& from, path const& to)
{
return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none));
}
inline bool copy_file(path const& from, path const& to, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none), &ec);
}
inline bool copy_file(path const& from, path const& to, // See ticket #2925
BOOST_SCOPED_ENUM_NATIVE(copy_options) options)
{
return detail::copy_file(from, to, static_cast< unsigned int >(options));
}
inline bool copy_file(path const& from, path const& to, // See ticket #2925
BOOST_SCOPED_ENUM_NATIVE(copy_options) options, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec);
}
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
inline bool copy_file(path const& from, path const& to, // See ticket #2925
BOOST_SCOPED_ENUM_NATIVE(copy_option) options)
{
return detail::copy_file(from, to, static_cast< unsigned int >(options));
}
inline bool copy_file(path const& from, path const& to, // See ticket #2925
BOOST_SCOPED_ENUM_NATIVE(copy_option) options, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec);
}
#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
inline void copy_symlink(path const& existing_symlink, path const& new_symlink)
{
detail::copy_symlink(existing_symlink, new_symlink);
}
inline void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code& ec) BOOST_NOEXCEPT
{
detail::copy_symlink(existing_symlink, new_symlink, &ec);
}
inline bool create_directories(path const& p)
{
return detail::create_directories(p);
}
inline bool create_directories(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::create_directories(p, &ec);
}
inline bool create_directory(path const& p)
{
return detail::create_directory(p, 0);
}
inline bool create_directory(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::create_directory(p, 0, &ec);
}
inline bool create_directory(path const& p, path const& existing)
{
return detail::create_directory(p, &existing);
}
inline bool create_directory(path const& p, path const& existing, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::create_directory(p, &existing, &ec);
}
inline void create_directory_symlink(path const& to, path const& from)
{
detail::create_directory_symlink(to, from);
}
inline void create_directory_symlink(path const& to, path const& from, system::error_code& ec) BOOST_NOEXCEPT
{
detail::create_directory_symlink(to, from, &ec);
}
inline void create_hard_link(path const& to, path const& new_hard_link)
{
detail::create_hard_link(to, new_hard_link);
}
inline void create_hard_link(path const& to, path const& new_hard_link, system::error_code& ec) BOOST_NOEXCEPT
{
detail::create_hard_link(to, new_hard_link, &ec);
}
inline void create_symlink(path const& to, path const& new_symlink)
{
detail::create_symlink(to, new_symlink);
}
inline void create_symlink(path const& to, path const& new_symlink, system::error_code& ec) BOOST_NOEXCEPT
{
detail::create_symlink(to, new_symlink, &ec);
}
inline bool equivalent(path const& p1, path const& p2)
{
return detail::equivalent(p1, p2);
}
inline bool equivalent(path const& p1, path const& p2, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::equivalent(p1, p2, &ec);
}
inline boost::uintmax_t file_size(path const& p)
{
return detail::file_size(p);
}
inline boost::uintmax_t file_size(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::file_size(p, &ec);
}
inline boost::uintmax_t hard_link_count(path const& p)
{
return detail::hard_link_count(p);
}
inline boost::uintmax_t hard_link_count(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::hard_link_count(p, &ec);
}
inline std::time_t creation_time(path const& p)
{
return detail::creation_time(p);
}
inline std::time_t creation_time(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::creation_time(p, &ec);
}
inline std::time_t last_write_time(path const& p)
{
return detail::last_write_time(p);
}
inline std::time_t last_write_time(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::last_write_time(p, &ec);
}
inline void last_write_time(path const& p, const std::time_t new_time)
{
detail::last_write_time(p, new_time);
}
inline void last_write_time(path const& p, const std::time_t new_time, system::error_code& ec) BOOST_NOEXCEPT
{
detail::last_write_time(p, new_time, &ec);
}
inline void permissions(path const& p, perms prms)
{
detail::permissions(p, prms);
}
inline void permissions(path const& p, perms prms, system::error_code& ec) BOOST_NOEXCEPT
{
detail::permissions(p, prms, &ec);
}
inline path read_symlink(path const& p)
{
return detail::read_symlink(p);
}
inline path read_symlink(path const& p, system::error_code& ec)
{
return detail::read_symlink(p, &ec);
}
inline bool remove(path const& p)
{
return detail::remove(p);
}
inline bool remove(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::remove(p, &ec);
}
inline boost::uintmax_t remove_all(path const& p)
{
return detail::remove_all(p);
}
inline boost::uintmax_t remove_all(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::remove_all(p, &ec);
}
inline void rename(path const& old_p, path const& new_p)
{
detail::rename(old_p, new_p);
}
inline void rename(path const& old_p, path const& new_p, system::error_code& ec) BOOST_NOEXCEPT
{
detail::rename(old_p, new_p, &ec);
}
// name suggested by Scott McMurray
inline void resize_file(path const& p, uintmax_t size)
{
detail::resize_file(p, size);
}
inline void resize_file(path const& p, uintmax_t size, system::error_code& ec) BOOST_NOEXCEPT
{
detail::resize_file(p, size, &ec);
}
inline path relative(path const& p, path const& base = current_path())
{
return detail::relative(p, base);
}
inline path relative(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return detail::relative(p, base, &ec);
}
inline path relative(path const& p, path const& base, system::error_code& ec)
{
return detail::relative(p, base, &ec);
}
inline space_info space(path const& p)
{
return detail::space(p);
}
inline space_info space(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::space(p, &ec);
}
#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool symbolic_link_exists(path const& p)
{
return is_symlink(filesystem::symlink_status(p));
}
#endif
inline path system_complete(path const& p)
{
return detail::system_complete(p);
}
inline path system_complete(path const& p, system::error_code& ec)
{
return detail::system_complete(p, &ec);
}
inline path temp_directory_path()
{
return detail::temp_directory_path();
}
inline path temp_directory_path(system::error_code& ec)
{
return detail::temp_directory_path(&ec);
}
inline path unique_path(path const& p = "%%%%-%%%%-%%%%-%%%%")
{
return detail::unique_path(p);
}
inline path unique_path(path const& p, system::error_code& ec)
{
return detail::unique_path(p, &ec);
}
inline path weakly_canonical(path const& p, path const& base = current_path())
{
return detail::weakly_canonical(p, base);
}
inline path weakly_canonical(path const& p, system::error_code& ec)
{
path base = current_path(ec);
if (ec)
return path();
return detail::weakly_canonical(p, base, &ec);
}
inline path weakly_canonical(path const& p, path const& base, system::error_code& ec)
{
return detail::weakly_canonical(p, base, &ec);
}
// test helper -----------------------------------------------------------------------//
// Not part of the documented interface since false positives are possible;
// there is no law that says that an OS that has large stat.st_size
// actually supports large file sizes.
namespace detail {
BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
} // namespace detail
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_OPERATIONS_HPP

View File

@@ -0,0 +1,384 @@
// filesystem path_traits.hpp --------------------------------------------------------//
// Copyright Beman Dawes 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#ifndef BOOST_FILESYSTEM_PATH_TRAITS_HPP
#define BOOST_FILESYSTEM_PATH_TRAITS_HPP
#include <boost/filesystem/config.hpp>
#include <boost/system/error_category.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/decay.hpp>
#include <boost/core/enable_if.hpp>
#include <cstddef>
#include <cwchar> // for mbstate_t
#include <string>
#include <vector>
#include <list>
#include <iterator>
#include <locale>
#include <boost/assert.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
namespace filesystem {
BOOST_FILESYSTEM_DECL system::error_category const& codecvt_error_category() BOOST_NOEXCEPT;
// uses std::codecvt_base::result used for error codes:
//
// ok: Conversion successful.
// partial: Not all source characters converted; one or more additional source
// characters are needed to produce the final target character, or the
// size of the target intermediate buffer was too small to hold the result.
// error: A character in the source could not be converted to the target encoding.
// noconv: The source and target characters have the same type and encoding, so no
// conversion was necessary.
class directory_entry;
namespace path_traits {
typedef std::codecvt< wchar_t, char, std::mbstate_t > codecvt_type;
// is_pathable type trait; allows disabling over-agressive class path member templates
template< class T >
struct is_pathable
{
static const bool value = false;
};
template<>
struct is_pathable< char* >
{
static const bool value = true;
};
template<>
struct is_pathable< const char* >
{
static const bool value = true;
};
template<>
struct is_pathable< wchar_t* >
{
static const bool value = true;
};
template<>
struct is_pathable< const wchar_t* >
{
static const bool value = true;
};
template<>
struct is_pathable< std::string >
{
static const bool value = true;
};
template<>
struct is_pathable< std::wstring >
{
static const bool value = true;
};
template<>
struct is_pathable< std::vector< char > >
{
static const bool value = true;
};
template<>
struct is_pathable< std::vector< wchar_t > >
{
static const bool value = true;
};
template<>
struct is_pathable< std::list< char > >
{
static const bool value = true;
};
template<>
struct is_pathable< std::list< wchar_t > >
{
static const bool value = true;
};
template<>
struct is_pathable< directory_entry >
{
static const bool value = true;
};
// Pathable empty
template< class Container >
inline
// disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for
// conforming compilers. Replace by plain "bool" at some future date (2012?)
typename boost::disable_if< boost::is_array< Container >, bool >::type
empty(Container const& c)
{
return c.begin() == c.end();
}
template< class T >
inline bool empty(T* const& c_str)
{
BOOST_ASSERT(c_str);
return !*c_str;
}
template< typename T, std::size_t N >
inline bool empty(T (&x)[N])
{
return !x[0];
}
// value types differ ---------------------------------------------------------------//
//
// A from_end argument of 0 is less efficient than a known end, so use only if needed
// with codecvt
BOOST_FILESYSTEM_DECL
void convert(const char* from,
const char* from_end, // 0 for null terminated MBCS
std::wstring& to, codecvt_type const& cvt);
BOOST_FILESYSTEM_DECL
void convert(const wchar_t* from,
const wchar_t* from_end, // 0 for null terminated MBCS
std::string& to, codecvt_type const& cvt);
inline void convert(const char* from, std::wstring& to, codecvt_type const& cvt)
{
BOOST_ASSERT(from);
convert(from, 0, to, cvt);
}
inline void convert(const wchar_t* from, std::string& to, codecvt_type const& cvt)
{
BOOST_ASSERT(from);
convert(from, 0, to, cvt);
}
// without codecvt
inline void convert(const char* from,
const char* from_end, // 0 for null terminated MBCS
std::wstring& to);
inline void convert(const wchar_t* from,
const wchar_t* from_end, // 0 for null terminated MBCS
std::string& to);
inline void convert(const char* from, std::wstring& to);
inline void convert(const wchar_t* from, std::string& to);
// value types same -----------------------------------------------------------------//
// char with codecvt
inline void convert(const char* from, const char* from_end, std::string& to, codecvt_type const&)
{
BOOST_ASSERT(from);
BOOST_ASSERT(from_end);
to.append(from, from_end);
}
inline void convert(const char* from, std::string& to, codecvt_type const&)
{
BOOST_ASSERT(from);
to += from;
}
// wchar_t with codecvt
inline void convert(const wchar_t* from, const wchar_t* from_end, std::wstring& to, codecvt_type const&)
{
BOOST_ASSERT(from);
BOOST_ASSERT(from_end);
to.append(from, from_end);
}
inline void convert(const wchar_t* from, std::wstring& to, codecvt_type const&)
{
BOOST_ASSERT(from);
to += from;
}
// char without codecvt
inline void convert(const char* from, const char* from_end, std::string& to)
{
BOOST_ASSERT(from);
BOOST_ASSERT(from_end);
to.append(from, from_end);
}
inline void convert(const char* from, std::string& to)
{
BOOST_ASSERT(from);
to += from;
}
// wchar_t without codecvt
inline void convert(const wchar_t* from, const wchar_t* from_end, std::wstring& to)
{
BOOST_ASSERT(from);
BOOST_ASSERT(from_end);
to.append(from, from_end);
}
inline void convert(const wchar_t* from, std::wstring& to)
{
BOOST_ASSERT(from);
to += from;
}
// Source dispatch -----------------------------------------------------------------//
// contiguous containers with codecvt
template< class U >
inline void dispatch(std::string const& c, U& to, codecvt_type const& cvt)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
}
template< class U >
inline void dispatch(std::wstring const& c, U& to, codecvt_type const& cvt)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
}
template< class U >
inline void dispatch(std::vector< char > const& c, U& to, codecvt_type const& cvt)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
}
template< class U >
inline void dispatch(std::vector< wchar_t > const& c, U& to, codecvt_type const& cvt)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to, cvt);
}
// contiguous containers without codecvt
template< class U >
inline void dispatch(std::string const& c, U& to)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to);
}
template< class U >
inline void dispatch(std::wstring const& c, U& to)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to);
}
template< class U >
inline void dispatch(std::vector< char > const& c, U& to)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to);
}
template< class U >
inline void dispatch(std::vector< wchar_t > const& c, U& to)
{
if (!c.empty())
convert(&*c.begin(), &*c.begin() + c.size(), to);
}
// non-contiguous containers with codecvt
template< class Container, class U >
inline
// disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for
// conforming compilers. Replace by plain "void" at some future date (2012?)
typename boost::disable_if< boost::is_array< Container >, void >::type
dispatch(Container const& c, U& to, codecvt_type const& cvt)
{
if (!c.empty())
{
std::basic_string< typename Container::value_type > s(c.begin(), c.end());
convert(s.c_str(), s.c_str() + s.size(), to, cvt);
}
}
// c_str
template< class T, class U >
inline void dispatch(T* const& c_str, U& to, codecvt_type const& cvt)
{
// std::cout << "dispatch() const T *\n";
BOOST_ASSERT(c_str);
convert(c_str, to, cvt);
}
// Note: there is no dispatch on C-style arrays because the array may
// contain a string smaller than the array size.
BOOST_FILESYSTEM_DECL
void dispatch(directory_entry const& de,
#ifdef BOOST_WINDOWS_API
std::wstring& to,
#else
std::string& to,
#endif
codecvt_type const&);
// non-contiguous containers without codecvt
template< class Container, class U >
inline
// disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for
// conforming compilers. Replace by plain "void" at some future date (2012?)
typename boost::disable_if< boost::is_array< Container >, void >::type
dispatch(Container const& c, U& to)
{
if (!c.empty())
{
std::basic_string< typename Container::value_type > seq(c.begin(), c.end());
convert(seq.c_str(), seq.c_str() + seq.size(), to);
}
}
// c_str
template< class T, class U >
inline void dispatch(T* const& c_str, U& to)
{
// std::cout << "dispatch() const T *\n";
BOOST_ASSERT(c_str);
convert(c_str, to);
}
// Note: there is no dispatch on C-style arrays because the array may
// contain a string smaller than the array size.
BOOST_FILESYSTEM_DECL
void dispatch(directory_entry const& de,
#ifdef BOOST_WINDOWS_API
std::wstring& to
#else
std::string& to
#endif
);
} // namespace path_traits
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP

View File

@@ -0,0 +1,68 @@
// filesystem/string_file.hpp --------------------------------------------------------//
// Copyright Beman Dawes 2015
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Library home page: http://www.boost.org/libs/filesystem
#ifndef BOOST_FILESYSTEM_STRING_FILE_HPP
#define BOOST_FILESYSTEM_STRING_FILE_HPP
#include <boost/filesystem/config.hpp>
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
#if !defined(BOOST_FILESYSTEM_DEPRECATED)
#include <boost/config/header_deprecated.hpp>
BOOST_HEADER_DEPRECATED("your own implementation")
#endif
#include <cstddef>
#include <limits>
#include <string>
#include <ios>
#include <stdexcept>
#include <boost/cstdint.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
namespace boost {
namespace filesystem {
inline void save_string_file(path const& p, std::string const& str)
{
filesystem::ofstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
file.open(p, std::ios_base::binary);
const std::size_t sz = str.size();
if (BOOST_UNLIKELY(sz > static_cast< boost::uintmax_t >((std::numeric_limits< std::streamsize >::max)())))
BOOST_FILESYSTEM_THROW(std::length_error("String size exceeds max write size"));
file.write(str.c_str(), static_cast< std::streamsize >(sz));
}
inline void load_string_file(path const& p, std::string& str)
{
filesystem::ifstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
file.open(p, std::ios_base::binary);
const boost::uintmax_t sz = filesystem::file_size(p);
if (BOOST_UNLIKELY(sz > static_cast< boost::uintmax_t >((std::numeric_limits< std::streamsize >::max)())))
BOOST_FILESYSTEM_THROW(std::length_error("File size exceeds max read size"));
str.resize(static_cast< std::size_t >(sz), '\0');
if (sz > 0u)
file.read(&str[0], static_cast< std::streamsize >(sz));
}
} // namespace filesystem
} // namespace boost
#include <boost/filesystem/detail/footer.hpp>
#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
#endif // BOOST_FILESYSTEM_STRING_FILE_HPP

View File

@@ -0,0 +1,13 @@
<html>
<head>
<meta http-equiv="refresh" content="0; URL=doc/index.htm">
</head>
<body>
Automatic redirection failed, please go to
<a href="doc/index.htm">doc/index.htm</a>.
<hr>
<p>&copy; Copyright Beman Dawes, 2003</p>
<p> Distributed under the Boost Software License, Version 1.0.
See http://www.boost.org/LICENSE_1_0.txt</p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
{
"key": "filesystem",
"name": "Filesystem",
"authors": [
"Beman Dawes"
],
"description": "The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories.",
"category": [
"System"
],
"maintainers": [
"Andrey Semashev <andrey.semashev -at- gmail.com>"
],
"cxxstd": "03"
}

View File

@@ -0,0 +1,32 @@
// atomic.hpp ------------------------------------------------------------------------//
// Copyright 2021 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_SRC_ATOMIC_REF_HPP_
#define BOOST_FILESYSTEM_SRC_ATOMIC_REF_HPP_
#include <boost/filesystem/config.hpp>
#if !defined(BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)
#include <atomic>
namespace atomic_ns = std;
#else // !defined(BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)
#include <boost/memory_order.hpp>
#include <boost/atomic/atomic_ref.hpp>
namespace atomic_ns = boost;
#endif // !defined(BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)
#endif // BOOST_FILESYSTEM_SRC_ATOMIC_REF_HPP_

View File

@@ -0,0 +1,69 @@
// atomic_tools.hpp ------------------------------------------------------------------//
// Copyright 2021 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
#ifndef BOOST_FILESYSTEM_SRC_ATOMIC_TOOLS_HPP_
#define BOOST_FILESYSTEM_SRC_ATOMIC_TOOLS_HPP_
#include <boost/filesystem/config.hpp>
#if !defined(BOOST_FILESYSTEM_SINGLE_THREADED)
#include "atomic_ref.hpp"
namespace boost {
namespace filesystem {
namespace detail {
//! Atomically loads the value
template< typename T >
BOOST_FORCEINLINE T atomic_load_relaxed(T& a)
{
return atomic_ns::atomic_ref< T >(a).load(atomic_ns::memory_order_relaxed);
}
//! Atomically stores the value
template< typename T >
BOOST_FORCEINLINE void atomic_store_relaxed(T& a, T val)
{
atomic_ns::atomic_ref< T >(a).store(val, atomic_ns::memory_order_relaxed);
}
} // namespace detail
} // namespace filesystem
} // namespace boost
#else // !defined(BOOST_FILESYSTEM_SINGLE_THREADED)
namespace boost {
namespace filesystem {
namespace detail {
//! Atomically loads the value
template< typename T >
BOOST_FORCEINLINE T atomic_load_relaxed(T const& a)
{
return a;
}
//! Atomically stores the value
template< typename T >
BOOST_FORCEINLINE void atomic_store_relaxed(T& a, T val)
{
a = val;
}
} // namespace detail
} // namespace filesystem
} // namespace boost
#endif // !defined(BOOST_FILESYSTEM_SINGLE_THREADED)
#endif // BOOST_FILESYSTEM_SRC_ATOMIC_TOOLS_HPP_

Some files were not shown because too many files have changed in this diff Show More