![]() |
Filesystem Release History |
| Home Tutorial Reference FAQ Releases Portability V4 V3 Intro V3 Design Deprecated Bug Reports |
BOOST_FILESYSTEM_VERSION macro to either 3 or 4 when compiling their code. There is no need to separately compile Boost.Filesystem for each library version — 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.path::filename, path::stem and path::extension 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 path("C:").filename() used to return "C:" and path("C:\\").filename() used to return "\" and both will return an empty path now. (#88, #194)path::stem and path::extension 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. (#88)path("\\\\.\\").stem() == "\\\\"). It is recommended to use the prefixes only with Boost.Filesystem v4.path::lexically_normal implementation to eliminate some cases of duplicate dot (".") elements in the normalized paths.statx and getrandom system calls on Linux. This can be useful if the syscall is present at compile time but fails with ENOSYS at run time (for example, in Docker containers that restrict the syscall, even if available on the host). (#172)copy_options::synchronize_data and copy_options::synchronize options for the copy_file 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 copy_file 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. (#186)EINTR error code on POSIX systems for some system calls issued internally. In particular, EINTR could have been ignored on close, which on HP-UX would result in a leaked file descriptor.copy_file implementations based on Linux sendfile and copy_file_range system calls, added handling of error codes indicating that a particular filesystem does not support the system call and fall back to the generic read/write loop. This should fix copy_file failing on eCryptFS and possibly other filesystems. (#184)copy_file_range system call is now used since Linux kernel 4.5, whereas previously it was only enabled since 5.3. The copy_file implementation will fall back to sendfile or read/write loop if copy_file_range fails to copy a given file across filesystems.copy_file implementations based on Linux sendfile and copy_file_range 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 read/write loop will be used instead. Currently, the blacklisted filesystems are: procfs, sysfs, tracefs and debugfs.copy_file implementation based on read/write 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.current_path 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.canonical, 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.canonical, added a limit for the maximum number of symlinks that can be resolved during the call. The limit is currently at least 40 symlinks.canonical and weakly_canonical will now use path::preferred_separator 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 ("\\?\"). (#87, #187)weakly_canonical overloads taking base path as an argument.weakly_canonical 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, weakly_canonical("C:\\a\\..") would previously fail if "C:\a" directory did not exist. (#201)read_symlink on Windows, corrected reparse point handling. The operation would return an empty path for some mount points (for example, created by Box 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. (#187)boost/filesystem/fstream.hpp will use wide character paths on libc++ versions 7.0 and higher, when the standard library supports opening files with wide character paths. (#181)path::imbue. The supported compilers include MSVC, GCC and Clang, as well as other compilers that support customizing program initialization order through #pragma section (for MSVC-compatible compilers) or __attribute__ ((init_priority)) (for GCC-compatible compilers).path::remove_filename if the path is "////". (#176)create_directories disregarding errors from file status query operations issued internally. This could result in incorrect error codes returned by create_directories. (#182)creation_time operation, which allows to obtain file creation time. (Inspired by PR#134)last_write_time(p, ec) operation in case of failure has been changed to a minimal value representable by std::time_t instead of -1.hard_link_count(p, ec) operation in case of failure has been changed to static_cast<uintmax_t>(-1) instead of 0.file_size will now indicate error code errc::function_not_supported if the path resolves to a non-regular file. Previously, errc::operation_not_permitted was reported.statx system call internally, when possible, which allows to reduce the amount of information queried from the filesystem and potentially improve performance. The statx system call was introduced in Linux kernel 4.11.const-qualification from return types of some path methods. This could prevent move construction and move assignment at the call site in some cases. (#160)statvfs system call to obtain filesystem space information. (Inspired by PR#162)space now returns with an error if the provided path does not idendify an existing file. (#167)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_dot 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%/TempGetWindowsDirectoryW()/Temppath 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.© Copyright Beman Dawes, 2011
© Copyright Andrey Semashev, 2019-2021
Use, modification, and distribution are subject to the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt