Commit Graph

7 Commits

Author SHA1 Message Date
Andrey Semashev
18a8a3430d Added support for removing read-only files on Windows.
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.
2021-11-18 14:54:17 +03:00
Andrey Semashev
c03249c375 Reformatted code for more consistent look and better readability. 2021-04-24 22:37:57 +03:00
Andrey Semashev
c653976208 Fixed mklink availability check in operations_test.
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.
2020-05-18 16:03:26 +03:00
Andrey Semashev
ee6604657d Fix 99_canonical_with_junction_point test not removing temp directory.
The test used to swich the current directory inside the temp directory
structure, which prevented it from removing it on exit.
2020-05-04 23:04:11 +03:00
Andrey Semashev
89b5152e86 Fixed check for mklink on Windows.
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.
2020-05-04 20:00:40 +03:00
Alexander Grund
37dd08caa5
Address review comments 2020-05-02 18:39:21 +02:00
Flamefire
ccb22fc517
Add test to trigger bug #99
Resolving junction points in read_symlink and canonical is wrong
2020-05-01 17:02:48 +02:00