This should silence MSVC warnings about path not being exported when used in
directory_entry. This should also remove unnecessary references to the library
for the inline members of directory_entry.
Removed library exports markup for file_status as there were nothing to export.
Also marked its methods constexpr.
Moved recursive_directory_iterator implementation to the library. MSVC should
not issue warnings since we're only exporting member functions.
Updated BOOST_SCOPED_ENUM emulation use to the more recent macros. Made sure
recursive_directory_iterator implementation uses binary compatible
representation for scoped enums between the library and user's code regardless
of C++ versions used.
The current_path() and read_symlink() algorithms had the potential to cause
memory exhaustion as they were looping trying to allocate exponentially larger
buffers without limit. Now the common limit is defined to 16MiB, the library
will not accept larger paths from the system calls. This is mostly a precaution
against broken or maliciously tampered with filesystems. Also, the functions
will start with a larger stack-based buffer to avoid dynamic memory allocation
at all in the best case scenario.
Also, increased the size of the buffer used by copy_file().
Corrected errno uses in a few places and made sure errno is read before it could
be modified by any system calls made by the error handling machinery.
Instead of exporting the whole path class, export only the functions that
are actually implemented in the shared library and leave the rest inline.
Also, move the definition of the static constants of the path class to
the header to avoid problems with exporting them from the shared library,
as observed with various MSVC versions and also gcc 7.3 from MinGW-w64.
Also, reduced code duplication and added a more efficient operator/
implementation when rvalue references are available.
Apparently, slicing was intentional, and the test verified that it worked.
This commit restores the previous behavior and disables the gcc warning
instead.
When an out-of-memory condition is detected (either by catching std::bad_alloc
or by receiving null on memory allocation), do not propagate the exception and
set an appropriate error code instead. This fix only concerns directory_iterator
and recursive_directory_iterator for now; it is possible that other operations
remain not ready for memory allocation failures.
Also, added recursive_directory_iterator::pop() that returns error code instead
of throwing an exception. This overload is present in C++17.
Fixes https://github.com/boostorg/filesystem/issues/58.
Closes https://github.com/boostorg/filesystem/pull/63.
Switched directory_iterator and recursive_directory_iterator to use
intrusive_ptr internally to reduce the iterator size and avoid virtual
function calls. The iterators now support move semantics. Fixed a warning
about deprecated in C++20 implicit generation of copy constructor and
assignment operator if there is a user-defined destructor.
Also updated a few includes to refer to non-deprecated headers. Trimmed
trailing spaces in headers and sources.