Filesystem Release History |
Home Tutorial Reference FAQ Releases Portability V3 Intro V3 Design Deprecated Bug Reports |
canonical
and read_symlink
on Windows. This also affects other algorithms that involve canonical
and read_symlink
in their implementation. (PR#100, #85, #99, #123, #125)read_symlink
on Windows could potentially fail or cause failures elsewhere with a sharing violation error, if the same symlink was opened concurrently. (#138)is_symlink(directory_entry)
would always return false
, even if the directory entry actually referred to a symlink. (PR#148)directory_entry
and error_code
(e.g. is_directory(directory_entry, error_code&)
). Removed incorrect noexcept
specifications for the overloads not taking the error_code
arguments.copy_file
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.copy_file
on POSIX systems will now also copy the source file permissions to the target file, if the target file is overwritten.copy_file
implementations based on sendfile
and copy_file_range
system calls on Linux, which may improve file copying performance, especially on network filesystems.copy_option
enumeration that is used with the copy_file
operation is deprecated. As a replacement, the new enum copy_options
(note the trailing 's') has been added. The new enum contains values similar to the copy_options
enum from C++20. The old enum values are mapped onto the new enum. The old enum will be removed in a future release.copy_options::skip_existing
option, which allows copy_file
operation to succeed without overwriting the target file, if it exists.copy_options::update_existing
option, which allows copy_file
operation to conditionally overwrite the target file, if it exists, if its last write time is older than that of the replacement file.copy_file
now returns bool
, which indicates whether the file was copied.copy
operation has been extended and reworked to implement behavior specified in C++20 [fs.op.copy]. This includes support for copy_options::recursive
, copy_options::copy_symlinks
, copy_options::skip_symlinks
, copy_options::directories_only
, copy_options::create_symlinks
and copy_options::create_hard_links
options. The operation performs additional checks based on the specified options. Applying copy
to a directory with default copy_options
will now also copy files residing in that directory (but not nested directories or files in those directories).create_directory
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.copy_directory
operation has been deprecated in favor of the new create_directory
overload. Note that the two operations have reversed order of the path arguments.equivalent
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. (#141)equivalent
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 equivalent
call.absolute
overloads taking error_code
argument.current_path()
as the default value of their arguments and also have an error_code
argument will use the current_path(error_code& ec)
overload to obtain the current path, so that its failure is reported via the error_code
argument instead of an exception.space
now initializes the space_info
structure members to -1 values on error, as required by C++20 ([fs.op.space]/1).space
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. (#73)temp_directory_path
for Windows CE. (PR#25)unique_path
operation based on getrandom
(Linux), arc4random_buf
(OpenBSD/FreeBSD/CloudABI) and BCrypt (Windows) system APIs.filesystem_error
to exception.hpp
; file_status
and associated enums and functions to file_status.hpp
; directory_entry
, directory_iterator
and recursive_directory_iterator
to directory.hpp
.operations.hpp
still includes the new headers exception.hpp
, file_status.hpp
and directory.hpp
, unless BOOST_FILESYSTEM_NO_DEPRECATED
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 filesystem.hpp
.filesystem_error
exception is now implemented in the compiled library of Boost.Filesystem. Users may need to add linking with Boost.Filesystem library in their projects.utimensat
instead of utime
. utime
is declared obsolete in POSIX.1-2008 and can be disabled e.g. in uClibc-ng. (PR#115)directory_iterator
is now left in the end state on memory allocation errors.directory_iterator
on POSIX systems, support for readdir
/readdir_r
has been reworked to avoid memory allocations for dirent
structures when readdir
is used. This reduces memory consumption and eliminates the possibility of buffer overruns in case if readdir
produces a very long directory name.directory_options
enum, which reflects the same named enum from C++20. The enum is supported in directory_iterator
and recursive_directory_iterator
to customize iteration behavior. In particular, the iterators now support skipping directories that can't be opened due to insufficient permissions. The symlink_option
enum is now deprecated and should be replaced with directory_options
.recursive_directory_iterator
is now reset to the end state in case of errors, as required by C++20. (#112)directory_options::pop_on_error
option, which configures recursive_directory_iterator
so that it attempts to recover from iteration errors by repeatedly invoking pop()
until it succeeds or the end state is reached. (#113)directory_options::skip_dangling_symlinks
option, which configures recursive_directory_iterator
so that it doesn't follow dangling directory symlinks and continues iteration instead of reporting an error.recursive_directory_iterator
are now marked as deprecated: level()
, no_push_pending()
, no_push_request()
, no_push()
. Users are advised to replace their use with the standard counterparts: depth()
, recursion_pending()
, disable_recursion_pending()
. Note that recursion_pending()
has the opposite meaning compared to no_push_pending()
and no_push_request()
. Deprecated methods will be removed in a future release.path::lexically_relative
(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 std::path::lexically_relative
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. (#76)error_code
returned from directory iterator increment when readdir_r
is used.path
, fixed rvalue-aware operator/
return type to return an rvalue instead of rvalue reference. This fixes leaving a dangling reference in the user's code if the result of operator/
is bound to a const reference. (#110)std::string::end()
in path implementation.error_code
. (#58)path
. (#12759)current_path
and read_symlink
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.copy_file
.readdir_r
on Linux and Android since the readdir
function is already thread-safe. (PR#68,
#72)boost::filesystem::copy
due to undefined behavior in the implementation. (PR#71)boost::filesystem::directory_iterator
implementation. (PR#77)BOOST_FOREACH
.is_empty()
overload with error_code
parameter
should not throw on error. Thanks to ldqrk for pull request #42space(p, ec)
. Thanks to cmuellner
for pull request #39.operations_test
failure on MinGW: MinGW defines
__MINGW32__ rather than _MSC_VER, so also test for __MINGW32__ to see if
setenv/unsetenv workaround needed.Deprecated generic()
function name: The undocumented experimental class
path
member function generic()
has been renamed
generic_path()
. Fixes
#11855, generic
gives problems in C++/CLI. Unless the macro BOOST_FILESYSTEM_NO_DEPRECATED
is defined, the original generic()
will continue to be supplied
as a workaround for existing user code. But generic()
is
deprecated. User code should migrate to the new name.
path
adds constexpr constants
separator
and dot
of the type appropriate for the
platform, and adds query functions
filename_is_do
t and
filename_is_dot_dot
.
These add convenience and the implementations may be more efficient that user
coded equivalent functions.directory_iterator
and
recursive_directory_iterator
equality testing has existed more than a
dozen years. Nowadays test driven development would likely have detected the
problem in early development. Sigh.create_directories()
crashes when passed empty string as path,
from Samantha Ritter. Also affected create_directory()
. Charles
Olivi submitted a pull request with some particularly helpful test cases.path
stem(), extension()
member functions. Thanks to faithandbrave for pull request #31push_directory()
internal logic so it is easier to
reason about.New: Added functions
lexically_normal
,
lexically_relative
,
relative
, and
weakly_canonical
. Many thanks to Jamie Allsop for his help and
perseverance. Resolves tickets
#1976,
#5897,
#6249
path
now has
reverse_iterator
,
const_reverse_iterator
, rbegin()
, and rend()
. noexcept
supplied as specified in the
Filesystem TS if supported by the compiler.size()
function to class path
. Resolves
#6874, Path
should have a size() member function.unique_path
by applying
pull request #15
from Sebastian Redl. Also fixes
#7506, unique_path
Fails on Windows for Temporary User
Profiles.file_status
and
recursive_directory_iterator
: C++ turns an explicit constructor
with all arguments except first defaulted into non-explicit single argument
constructor.Fix #11288, A patch to avoid redundant string allocations, by applying a patch submitted by Yevhen Ivannikov.
remove()
.Fix #7258,
create_directories
returns false if the path ends with a slash.
Also fix related issues if path contains dot or dot-dot
elements, and added test cases to the test suite.
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.
parent_path()
and filename()
sections of the reference
docs.path
reverse iteration
feature. The reference documentation has also been updated with
a note warning about the
limitations of class path
iterators.temp_directory_path()
doesn't return valid temp path on Android.temp_directory_path()
to (1) avoid
GetTempPath()
failure if path length > 130 (ticket #5300) and (2) provide a
more sensible sequence of directories than provided by GetTempPath()
, per
boost list discussion "[filesystem] temp_directory_path() behavior on
Windows". The new sequence is:%TMP%
%TEMP%
%LOCALAPPDATA%/Temp
%USERPROFILE%/Temp
GetWindowsDirectoryW()/Temp
path
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.mklink /j link target
". There is no plan for Boost.Filesystem to
be able to create them directly other than by calling std::system()
.recursive_directory_iterator::increment
, adding an
invariant that progress is always made, even if an error is reported by
exception or error_code. Add a manually executed test,
test/issues/recurse_dir_iter_5403.cpp
. Adjust regular regression tests
as needed. Thanks to Claudio Bley for the
pull request - the
change was incorporated into the reorganized code. Fixes
#5403 and
#6821.canonical()
to treat parent of root as root. (Christian
Hammerl) Fixes #9683
and #10187.__sun
macro which is defined on
Solaris 10. (Chris Stylianou)const char colon
to clear clang warning. (J?gen
Hunold)class filesystem_error
.perms::all_all
and perms::perms_mask
to
absolute values to quiet intellisense warnings, and conform to C++11.path::codecvt()
and path::imbue()
with portable code that is intended to be much more robust and maintainable. A
section on path usage concerns has
been added to the reference documentation describing several concerns that
arise in the context of multithreading and path::codecvt()
.create_directories(":D")
. The reported
problem was a symptom of an internal bug that caused path::filename()
and path::parent_path()
to fail on Windows for path(":")
,
and that in turn caused other functions that depend on filename()
or parent_path()
to fail, such as create_directories()
.constexpr value_type preferred_separator
to class path.replace_extension
doesn't work as specified in documentation. 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.compare
for consistency with
std::string.symlink_option
to recursive_directory_iterator
,
allowing control over recursion into directory symlinks. Note that the default
is changed to not recurse into directory symlinks.Revised 07 August, 2017
© Copyright Beman Dawes, 2011
Use, modification, and distribution are subject to the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt