1571 Commits

Author SHA1 Message Date
Alexander Grund
f1bf0e01e2 Fix build on MinGW-w64 x86
32 bit version of MinGW-64 __MINGW64__ is not defined
2024-08-25 18:56:45 +02:00
Alexander Grund
3f26465afb Remove C++03 build 2024-08-25 18:56:45 +02:00
Alexander Grund
ac94c483e5 Add CI jobs for MinGW32/64 2024-08-25 17:55:38 +02:00
Andrey Semashev
5dc58be3cd Changed suppression of signed/unsigned mismatch to explicit casts.
Turns out, suppressing -Wsign-compare doesn't work on gcc 8 in MinGW-w64
at least in one instance. So we have to do it the hard way and explicitly
cast NTSTATUS values on every comparison.
2024-08-25 18:09:53 +03:00
Andrey Semashev
bfb06365b3 Disable -Wsign-compare on Windows.
STATUS_* constants defined in ntstatus.h are defined as DWORDs, and NTSTATUS
is long. This results in signed/unsigned mismatch warnings emitted by gcc and
clang. Consider that a platform bug and disable the warning.

Closes https://github.com/boostorg/filesystem/issues/321.
2024-08-25 16:12:07 +03:00
Andrey Semashev
41a990ef14 Fix weakly_canonical with relative input paths.
When weakly_canonical was called with a relative input path, the operation
would test path elements for existence, which meant resolving them relative
to the current path instead of the base path specified in the call. To
mitigate this, make the source path absolute using the specified base path.

As a side effect, this fixes incorrect path produced on Windows if the
input path started with "..". The algorithm was unable to remove the last
element of the head path because there was none. As a result, the remaining
elements of the input path were appended to the full base path by canonical.

Fixes to https://github.com/boostorg/filesystem/issues/311.
boost-1.86.0.beta1 boost-1.86.0
2024-07-03 15:02:47 +03:00
Andrey Semashev
c8093eeb7a Update test order to avoid spurious test failures due to timing.
copy_file_tests with copy_options::update_existing used to fail sometimes,
when the last modification timestamps on the test files were close enough.
Run the tests after a pause to make sure the timestamps are far enough apart.
2024-06-29 14:39:56 +03:00
Andrey Semashev
9f8dea7353 Don't throw in directory_entry::refresh if the file doesn't exist.
This makes directory_entry::status, directory_entry::symlink_status, as well
as related methods behave similarly to the equivalent standalone operations.

std::filesystem specification for directory_entry::refresh doesn't explicitly
say that the file not existing is not an error, but it does say that
directory_entry::status and directory_entry::symlink_status should behave
the same way as the standalone operations. Currently, libstdc++, libc++
and MSVC standard library all avoid throwing the exception from
directory_entry::refresh if the file doesn't exist.

Closes https://github.com/boostorg/filesystem/issues/314.
2024-06-29 14:00:49 +03:00
Andrey Semashev
7ff9487376 Corrected test console output. 2024-06-19 13:48:26 +03:00
Andrey Semashev
5d16e6bd00 Fixed file_size and is_empty for symlinks on Windows. Reworked is_empty.
GetFileAttributesExW that was used to implement file_size and is_empty
on Windows returns information about the symlink rather than the file
the symlink refers to. Fix this by opening the file and using
GetFileInformationByHandle to obtain the file size and attributes.

Additionally, reworked is_empty implementation to reuse the file handle
(and fd on POSIX systems) to create the directory iterator if the
operation is invoked on a directory. On POSIX systems, implement a
more lightweight version of is_empty_directory when readdir is safe
to use. Reusing the file handle/fd improves protection against
filesystem races, when the file that is being tested by is_empty
is initially a directory and then, when we create a directory
iterator, it is not.

Fixes https://github.com/boostorg/filesystem/issues/313.
2024-06-18 22:33:20 +03:00
Andrey Semashev
3274d64e2a Added macos-12 and 13 testing in addition to latest (which is 14). 2024-05-21 01:09:26 +03:00
Andrey Semashev
94132ebe49 Use macos-latest image as macos-11 is being removed. 2024-05-21 01:01:59 +03:00
Andrey Semashev
a0c8edba38 Documentation fixes. boost-1.85.0 2024-03-24 00:10:13 +03:00
Andrey Semashev
6f174ba143 Moved Boost.Core to private dependencies in CMakeLists.txt. boost-1.85.0.beta1 2024-02-20 04:10:50 +03:00
Andrey Semashev
4fa79df681 Removed unnecessary include. 2024-02-20 04:07:33 +03:00
Andrey Semashev
7bdccb0d2f Use <type_traits>, when possible. 2024-02-20 01:38:29 +03:00
Andrey Semashev
46af0a9514 Use unique_ptr instead of Boost.SmartPtr scoped_* pointers. 2024-02-20 01:04:32 +03:00
Andrey Semashev
8dd5b0e0ad Use unique_resource on Windows to wrap HANDLEs. 2024-02-20 00:55:43 +03:00
Andrey Semashev
e9621c0585 Reworked directory iterator construction with parameters.
Instead of passing a base directory fd, pass the directory fd to iterate over.
This simplifies code a little and makes it closer to Windows version.

Also, use unique_fd from Boost.Scope instead of a custom fd wrapper. Also
added handling of EINTR returned from open/openat in more places.
2024-02-19 02:57:16 +03:00
Andrey Semashev
9f6bf1a433 Use openat-style APIs on Windows to implement recursive_dir_iterator.
This makes recursive_directory_iterator more protected against filesystem
changes during iteration.
2024-02-18 03:25:47 +03:00
Andrey Semashev
081d00509b Added more NTSTATUS errors. 2024-02-17 20:16:42 +03:00
Andrey Semashev
7eece0064a On POSIX systems, use *at APIs in recursive_directory_iterator.
This makes the iterator more resilient to concurrent filesystem
modifications.
2024-02-12 01:07:44 +03:00
Andrey Semashev
d3f4ad6fb1 Updated tut6 examples, added their targets to Jamfile. 2024-02-12 01:05:14 +03:00
Andrey Semashev
6db7c58ff8 Removed MinGW32 AppVeyor job.
This compiler is no longer supported by Boost.System.

https://github.com/boostorg/system/issues/116
2024-02-06 23:56:37 +03:00
Andrey Semashev
06cb8d4007 Added gcc-13 CI job. 2024-02-06 00:46:17 +03:00
Andrey Semashev
da43e63ce9 Reduced CI job timeouts. 2024-02-05 23:53:24 +03:00
Andrey Semashev
55fb00c7ad Replaced actions/checkout usage with manual download commands.
This fixes the deprecation warnings for actions/checkout@v3. actions/checkout@v4
is not functional because of the upstream bug:

https://github.com/actions/checkout/issues/1590
2024-02-05 23:50:42 +03:00
Andrey Semashev
a10762e8b1 Removed usage of removed is_regular function. 2024-01-27 01:15:34 +03:00
Andrey Semashev
a668706004 Added docs for replacements for removed APIs in convenience.hpp. 2024-01-27 01:06:38 +03:00
Andrey Semashev
183cd3f3f5 Removed gcc-4.7 from GHA CI.
Boost.System has dropped support for gcc-4.7.
2024-01-20 04:21:04 +03:00
Andrey Semashev
47dd78b32f Fixed mismatching HTML tags in docs. 2024-01-20 03:21:56 +03:00
Andrey Semashev
5156746cd9 Partly restore documentation of the removed deprecated APIs.
This partly restores documentation removed in
5df060e95c and moves the features from
"deprecated" table to a new "removed" table. This provides users
with suggested replacements for the removed features.
2024-01-18 20:16:04 +03:00
Andrey Semashev
90fe5e8980 Updated C++23 switch for clang-17. 2024-01-14 22:34:16 +03:00
Andrey Semashev
715607c274 Added clang-17 GHA jobs. 2024-01-14 22:32:07 +03:00
Andrey Semashev
fba5ef2aa4 Updated copyright year in CI config. 2024-01-14 22:15:48 +03:00
Andrey Semashev
4530e2496c Pass enum values to the compiled library.
Since we now require C++11 scoped enums and removed deprecated enums,
we can now pass copy_options and directory_options to the compiled
library without converting to the underlying type.
2024-01-14 18:28:05 +03:00
Andrey Semashev
5df060e95c Removed deprecated APIs.
Removed APIs that were marked as deprecated a long time ago. Disabled
by default support for path construction, assignment and appending from
container types. Users can still enable this functionality by defining
BOOST_FILESYSTEM_DEPRECATED.

Updated docs, tests and examples accordingly.
2024-01-14 17:48:44 +03:00
Andrey Semashev
c0b3b7f2d8 Use a unique path in cstdio test. 2024-01-14 04:28:35 +03:00
Andrey Semashev
d38f590b52 Use unique filename in narrow character fstream test. 2024-01-14 03:30:28 +03:00
Andrey Semashev
3b55b7b0d3 Use C++11 language features unconditionally.
Use nullptr, rvalue references, default function template parameters,
deleted/defaulted functions, noexcept, final, override and scoped enums.

Don't use constexpr yet, as it would raise MSVC requirement.
2024-01-13 19:32:42 +03:00
Andrey Semashev
fc243122b9 Added a copy_options::ignore_attribute_errors option for copy_file/copy.
The new option allows to ignore errors while copying file attributes
(but not file contents).

Closes https://github.com/boostorg/filesystem/issues/179.
2024-01-13 17:22:16 +03:00
Andrey Semashev
7ff596a8df v4: Make absolute() produce a trailing slash for empty input path.
This follows the absolute() definition in the docs, as in v4 appending
an empty path results in a trailing slash.

Unfortunately, this also influences canonical and weakly_canonical,
so we had to duplicate those for v3 and v4 as well.

Fixes https://github.com/boostorg/filesystem/issues/301.
2024-01-08 20:42:32 +03:00
Andrey Semashev
ccbb58c018 Use unique file name in fstream_test. 2024-01-08 03:33:04 +03:00
Andrey Semashev
d574ae5503 Replaced is_regular with is_regular_file call. 2024-01-08 02:42:23 +03:00
Andrey Semashev
1426ca53b4 v4: Make equivalent() fail if only one of the paths exists.
In v3, equivaluent would successfully return false if one of the paths
existed and the other one didn't. v4 now fails in this case, similar
to std::filesystem.
2024-01-08 02:35:29 +03:00
Andrey Semashev
56c5f6ac1d Updated canonical docs to only require absolute(p, base) to exist.
This reflects the actual implementation and effectively allows
canonical("") to work, which is essential for weakly_canonical("a/b"),
where "a" doesn't exist, to succeed.

Related to https://github.com/boostorg/filesystem/issues/300.
2024-01-07 14:46:17 +03:00
Andrey Semashev
d7e6e3100a Added storage preallocation for the target file in copy_file on Linux.
Use Linux fallocate system call to preallocate storage for the target
file in copy_file backends based on sendfile and copy_file_range. These
backends are only used when the file size is known beforehand, and
preallocating storage allows to reduce filesystem fragmentation and
get an early error if there's not enough free space on the target
filesystem.

Preallocation is only done as an optimization/hint. On filesystems
that do not support it we continue the data copying process as before.
This is why we aren't using posix_fallocate, because glibc contains
an emulation path that is used when the filesystem doesn't support
the functionality. We don't want this emulation, as it would effectively
double the amount of written data.
2024-01-05 15:41:01 +03:00
Andrey Semashev
cf135d3f69 Fix weakly_canonical for relative paths that don't exist in the filesystem.
If the input path is relative and none of its elements exist in the filesystem,
the head path calculated in weakly_canonical is empty. In this case, we still
need to call canonical on it to produce an absolute path (which will be
equivalent to the base path) and append the tail path to it.

Fixes https://github.com/boostorg/filesystem/issues/300.
2024-01-04 19:25:32 +03:00
Andrey Semashev
9361213a91 Added a unique_path overload taking a single error_code& argument.
The overload uses the default path model.

Also, express the default model in native characters to avoid unnecessary
character code conversion.
2024-01-04 18:47:50 +03:00
Andrey Semashev
b87d2790e7 v4: Avoid converting slashes in path root name in path::make_preferred.
Similarly to other methods, make_preferred is only supposed to affect
directory separators and not the slashes that are part of the path
root name.
2024-01-04 04:07:46 +03:00