The copy_file operation implementation has been inlined into the
detail::copy_file function. The part that copies the file body has been
extracted to a separate function, so that addition of specialized copy
implementations later is possible.
Added copy_options enum, which reflects the enum from C++20. Currently,
only overwrite_existing option is supported. Other options will be added
later.
The old enum copy_option is deprecated in favor of copy_options.
Updated docs to reflect recent changes to copy_file behavior.
space() now initializes space_info members to -1 values, which is used when the
structure is returned in case of error.
On Windows, check if the path refers to a directory, and use the parent
directory if not. In order to make sure we return space information for the
target filesystem, we have to resolve symlinks in this case.
Fixes https://github.com/boostorg/filesystem/issues/73.
This ensures that the files overwritten or created by copy_file have the same
permission bits as the source file, as required by C++20. Also, for the duration
of the copy operation we ensure the target file has writing permission set.
This is important e.g. for NFS, which checks the permission on the server,
so a writable file descriptor on the client is not enough for the write
operation to succeed.
Notably, this doesn't save the case of overwriting the file with no write
permission set. In this case the operation will fail with EPERM.
Also, use fsync/fdatasync to guarantee that the target file is written
completely without errors before closing the file descriptor.
The POSIX copy_file implementation has beed reworked to perform checks for
whether the source and target files are regilar files and whether the source
and target paths identify the same file. Also, the implementation has been fixed
to report the correct error code from the failed operation to the caller
in case of failure. The implementation is now also protected against EINTR
errors and uses O_CLOEXEC when possible to avoid leaking file descriptors
if the caller process forks.
Also, the file equivalence test is now simplified to not test the file size
and last modification time. These tests had a potential of causing a false
negative, if the file that is being tested was modified between the stat()
calls that were used to obtain file information from the paths.
Closes https://github.com/boostorg/filesystem/pull/48.
The algorithm implementation now ignores empty and dot path elements in the
argument path and accounts dot-dot elements by decreasing the number of
dot-dot elements to generate in the resulting relative path. This is
according to C++17 std::path specification [fs.path.gen]/4.
Fixes https://github.com/boostorg/filesystem/issues/76.
The new option allows to skip dangling directory symlinks when iterating
over a directory using recursive_directory_iterator.
This also updates the operations_test, which failed spuriously because
the test created dangling symlinks for some of its checks. Since the order
of iteration is undefined, the tests sometimes passed, when the dangling
symlinks were encountered late during the iteration.
The directory_options enum reflects the same-named enum from C++20. It is now
supported by both directory_iterator and recursive_directory_iterator. In
particular, both iterators now support skip_permission_denied option.
recursive_directory_iterator is now set to end by default on errors, as
required by C++20. An additional directory_options::pop_on_error policy
is added to allow the iterator recover from an error. When this option is
specified and an error occurs, the iterator repeatedly pops the recursion level
until the pop completes successfully or the end state is reached.
recursive_directory_iterator that have standard counterparts (level,
no_push_pending, no_push_request and no_push) are now deprecated and can be
removed by defining BOOST_FILESYSTEM_NO_DEPRECATED. These members will be
removed in a future release.
Docs and tests updated accordingly. Also, in docs reconstructed release history
for the past releases from Boost release notes.
Fixes https://github.com/boostorg/filesystem/issues/112
Fixes https://github.com/boostorg/filesystem/issues/113