Reworked remove() operation to separate POSIX and Windows implementations.
On Windows, if the file to be removed is read-only, try to reset the read-only
attribute before deleting the file. If deleting fails (other than because the
file is already deleted), try to restore the read-only attribute.
As a side effect, we were able to remove an implementation detail value from
the file_type enum that was used by the old remove() implementation.
Added a test for remove() on a read-only file on Windows. Also added tests
for remove_all(), including for cases with symlinks, hardlinks and read-only
files.
Also, corrected mklink /J argument in tests. The command accepts /j (lowercase)
to the same effect, but the formal help lists /J (uppercase) to create junctions.
Reported in https://github.com/boostorg/filesystem/issues/216.
The contents is (a) language dependent and (b) is modified by some
standard libraries (e.g. libstdc++ and Dinkumware) and possibly OS,
which causes test failures on AppVeyor.
- Unified root name and root directory parsing that was scattered and
duplicated across different algorithms. The new implementation is
consolidated in a single function for parsing root name and root
directory, which is used from various algorithms.
- The new root name parsing now supports Windows local device ("\\.\")
and NT path ("\??\") prefixes. It also adds support for filesystem
("\\?\") prefix to some of the higher level algorithms that were
using custom parsing previously. Tests updated to verify these prefixes.
- Some of the path decomposition methods were unified with presence checking
methods (e.g. root_name with has_root_name). This makes these methods
work consistently and also makes the has_* methods less expensive as
they no longer have to construct a path only to check if it is empty.
- The filename accessor no longer returns root name if the whole path
only consists of a root name. This also affects stem and extension as
those accessors are based on filename. This is a breaking change.
- Cleaned up code:
- Removed redundant checks for std::wstring support.
- Added header/footer headers to globally disable compiler warnings.
- Removed commented out super-deprecated code.
- Added missing includes and removed includes that are not needed.
- Nonessential code formatting.
Instead of enabling/disabling the test compilation, define a macro when
mklink shell command is detected to be available. Test this macro
in all tests that use this command to create junctions and symlinks
on Windows.
Also, renamed reparce_tag_file_placeholder.cpp test to fix a spelling
error.
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.
For some unknown reason, Windows 8.1 system shell returns error code 1 when
invoking mklink to test if it exists. To work around this we now analyze
output of the command in the Jamfile. As an added bonus, the test is not
compiled when mklink is not supported.