Commit Graph

44 Commits

Author SHA1 Message Date
Andrey Semashev
f7930053c8 Corrected error handling and aded checks for exceptions. 2022-02-21 14:38:20 +03:00
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
fc2da43e81 Stop testing exception message contents.
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.
2021-10-17 22:54:58 +03:00
Andrey Semashev
4b84226783 Refactored path implementation for better support Windows path prefixes.
- 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.
2021-06-05 19:52:33 +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
a916a41602
Merge pull request #102 from stima/develop
Correct handling status of reparse point
2020-05-06 14:59:59 +03:00
Roman Savchenko
ed9e019b01 Add test for reparse point that is not symlink 2020-05-06 13:37:28 +03:00
Andrey Semashev
f199152b7d Refactored copy_file, added copy_options, deprecated copy_option.
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.
2020-05-05 18:34:20 +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
Andrey Semashev
0fcfd93407 Updated lightweight_test.hpp includes to the new location. 2020-03-04 00:49:27 +03:00
Andrey Semashev
27256f9d55 Removed asynch-exceptions=on for MSVC. 2019-01-14 20:46:59 +03:00
Andrey Semashev
c0c93a0c58 Removed linking with Boost.System from docs and examples. 2019-01-14 20:40:06 +03:00
Andrey Semashev
e268f557df Trim trailing spaces in the tests. 2018-11-24 15:23:43 +03:00
Peter Dimov
a183553454 Add a test for the fs::copy issue in PR #70/#71 2018-09-05 22:24:09 +03:00
Beman
a2d4f99cc8 Resolve #11166 by mitigating (i.e. reducing the likelihood of) a possible external file system race in remove(), using a slight refinement of the patch supplied by Jeff Epler. Made no attempt to fix or mitigate the thread data race in the test program provided. 2015-09-01 11:34:24 -04:00
Beman
f6aa067256 Minor code and comment tweaks. 2015-08-31 10:23:41 -04:00
Beman
efe50fad52 Work issue, but no fix yet 2015-08-30 16:32:44 -04:00
Beman
f35a14e004 Add copy_file-compilation-error-2015-05-04.cpp 2015-05-24 08:20:45 -04:00
Beman
1c104ba10f Add issue tests for 4329, 5300, 10205 2015-03-27 20:01:52 -04:00
Beman
96d5cdda3b Remove test_folder. Content is now in branch test-files/utf-8, so that master and develop conform to Boost file naming policy. 2015-01-11 17:55:55 -05:00
Beman
0dfb7171fb Finalize issue reporting before requesting comments. Also fix some inspect issues. 2014-12-29 09:18:12 -05:00
Beman
1ac23b633e No point in inspecting the Chinese names being tested. 2014-12-24 08:37:41 -05:00
Beman
5a0e0609c5 Switch to the VC++ codepage 950 codecvt facet. Verified output correct. 2014-12-24 08:25:54 -05:00
Beman
785d521b54 Add infrastructure. Use UTF-8. 2014-12-24 07:17:56 -05:00
Beman
fdc4355a45 Initial commit 2014-10-29 09:10:17 -04:00
Beman
316084261c Initial commit. 2014-10-27 19:30:47 -04:00
Beman
6cafaf5e34 Add issue 10485. 2014-10-26 08:36:58 -04:00
Beman
35096ca056 Add 9219.cpp plus infrastructure and path.cpp logging 2014-08-17 10:55:01 -04:00
Beman
0e16e5bdff Replace more <boost/test/prg_exec_monitor.hpp> usage with <boost/detail/lightweight_main.hpp>. 2014-08-06 12:19:29 -04:00
Beman
63ad0348aa Add hello_filesystem.cpp and related infrastructure so we have a handy starting point for building quick tests. 2014-08-05 15:14:04 -04:00
Beman
750a82e20d Revert "Merge branch 'develop' of github.com:boostorg/filesystem into develop"
This reverts commit 4610afc49e, reversing
changes made to 6623bde4fe.
2014-08-05 09:16:57 -04:00
Beman
4610afc49e Merge branch 'develop' of github.com:boostorg/filesystem into develop 2014-08-04 20:25:07 -04:00
Beman
6623bde4fe Fix Jamfile boo boo 2014-08-04 20:21:45 -04:00
Beman
96d7c10731 Initial commit and update Jamfile 2014-08-04 16:56:14 -04:00
Beman
98b29a72e5 Fix-up of prior merge conflict resolution from develop. 2014-07-23 09:39:26 -04:00
Beman
0a692332f3 test/issues/Jamfile.v2 initial commit. 2014-07-20 17:15:39 -04:00
Beman
ff1eef7670 Update test to reflect the recursive_directory_iterator::increment invariant to be added that progress is always made, allowing loops to terminate even if errors occur. 2014-07-20 09:01:53 -04:00
Beman
23d2fcb9e0 recurse_dir_iter_5403.cpp initial commit. 2014-07-19 14:39:45 -04:00
Beman Dawes
119447d8c1 Add a #error if NDEBUG is defined.
[SVN r79468]
2012-07-13 12:56:36 +00:00
Beman Dawes
d5328e4d05 Add a directory for issues related test programs.
[SVN r79467]
2012-07-13 12:28:08 +00:00