1431 Commits

Author SHA1 Message Date
Andrey Semashev
7745d57ca8 Added a note about C++03 deprecation. 2023-03-29 02:08:19 +03:00
Andrey Semashev
656c5922c0 Expanded description of Windows path prefixes. boost-1.82.0.beta1 2023-02-12 02:27:06 +03:00
Andrey Semashev
cace399f2c Added simple_ls to examples Jamfile. 2023-02-12 02:14:26 +03:00
Andrey Semashev
7509619c9e Updated library version selection to avoid ODR violations.
The previous strategy of force-inlining methods that are dependent
on the library version is not effective with MSVC in debug mode,
when linking the static library. The compiler does not inline
methods despite the markup, and during linking the static library
with the user's module the linker may or may not pick up user's
definitions of these methods.

When building the library, do not define path methods that depend
on the library version. Instead, explicitly call v4 internal methods
throughout the implementation. This way the compiled library does not
contain v4 versions of these methods, and therefore does not conflict
with user's definitions of these methods.

Fixes https://github.com/boostorg/filesystem/issues/279.
2023-02-08 01:00:54 +03:00
Andrey Semashev
5bebf7805a Silenced clang warnings about self-assignment. 2023-02-07 14:47:37 +03:00
Andrey Semashev
b3c5e11f16 Silenced clang warnings about unused to_string function. 2023-02-07 13:39:11 +03:00
Andrey Semashev
5f2d434a9d Silenced clang warnings about unnamed types in template parameters. 2023-02-07 13:22:44 +03:00
Andrey Semashev
f6c99195d5 Updated Windows tests for the changed path::remove_filename behavior in v4. 2023-02-07 02:22:48 +03:00
Andrey Semashev
32a3878d6a Updated copyrights. 2023-02-05 20:35:00 +03:00
Andrey Semashev
b6ecf3013d Added v4 path::remove_filename. Added path::replace_filename.
v4 remove_filename works similar to std::filesystem, i.e. preserves
the trailing directory separator after removing the filename.
v3 remove_filename works as before. Its behavior is also useful in
v4, so added a new method remove_filename_and_trailing_separators
with the same behavior.

Also added replace_filename that was previously missing.

remove_filename discrepancy from std::filesystem was reported in:

https://github.com/boostorg/filesystem/issues/271
2023-02-05 20:25:50 +03:00
Andrey Semashev
0c8931b74f Make installing tutorial example binaries explicit.
This resolves build error if examples are compiled for multiple
target configurations. When building tutorial examples, only one
target is supposed to be used.
2023-02-05 01:10:31 +03:00
Andrey Semashev
b3acfca7c5 Updated tutorial to remove references to scripts that were long deleted.
Closes https://github.com/boostorg/filesystem/issues/276.
2023-02-05 00:13:41 +03:00
Andrey Semashev
0451cb206d Fixed compilation with gcc in C++23 mode. 2023-02-04 23:20:04 +03:00
Andrey Semashev
f05ac885d1 Disabled construction and assignment of path from nullptr.
It is always an error and UB. Explicitly deleting the functions produces
better compiler errors.

Closes https://github.com/boostorg/filesystem/issues/278.
2023-02-04 20:24:18 +03:00
Andrey Semashev
5cefe7890f Remove path converting constructors from types convertible to path sources.
This causes ambiguities in users' code where the previously added conversion
from user-defined types that have a conversion to one of the path source
types:

  struct my_class
  {
    operator std::string() const;
  };

  std::string to_string(std::string const&);
  std::string to_string(boost::filesystem::path const&);

  to_string(my_class());

The above call is ambiguous as the conversion operator in my_class and
a converting constructor in boost::filesystem::path from my_class are
both available and have equivalent ranks.

Removing the conversion constructors from boost::filesystem::path
means users will have to explicitly cast their types to one of the
path source types before constructing path.

In order to preserve backward compatibility with operator== and operator!=
for paths that also accepted source types (path::string_type,
const path::value_type*), we have to update path::compare and comparison
operators to accept types that are convertible to source types.

Fixes https://github.com/boostorg/filesystem/issues/273.
2023-02-04 19:55:17 +03:00
Andrey Semashev
9a49c4f3f4 Ported to BOOST_DEPRECATED macro from Boost.Config. 2022-12-22 18:38:40 +03:00
Andrey Semashev
022c68d481 Added -Wno-restrict for gcc-12.
This disables bogus warnings coming from libstdc++ on string
assignments and appends.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651
2022-12-18 02:14:16 +03:00
Andrey Semashev
d204b41dba Use access() to check if the root directory is writable.
This is more reliable than testing if the user is root as in some
chroot environments root directory may be writable by a non-root user.
2022-12-15 15:53:42 +03:00
Andrey Semashev
141727b568 Treat dedup files as regular files on Windows.
Deduplicated files are reparse points with IO_REPARSE_TAG_DEDUP tag. Such
files are created by a dedup service running in the background, so a regular
file may be converted to a dedup reparse point at any time and without user's
intervention. For all intents and purposes dedup files should look like
normal, regular files, so it makes sense to report them as such in
Boost.Filesystem methods like status(), symlink_status() and everything
based on those. This commit implements this.

Closes https://github.com/boostorg/filesystem/issues/262.
boost-1.81.0
2022-12-03 02:15:13 +03:00
Andrey Semashev
48933c5573 Handle ERROR_CALL_NOT_IMPLEMENTED in remove_nt6_by_handle.
As with directory iterator, ERROR_CALL_NOT_IMPLEMENTED may be returned
by SetFileInformationByHandle in Wine if it doesn't support a certain
information class. Downgrade to an older info class in this case.
2022-12-03 01:50:37 +03:00
Andrey Semashev
c1a48fcdac Use synchronous IO on file handles created in remove_all NT6 implementation.
This eliminates spinning while iterating over directory contents as by default
file handles created by NtCreateFile are non-blocking. Because of this
NtQueryDirectoryFile didn't block and returned STATUS_PENDING without actually
updating the iteration state. Eventually this would cause directory iteration
to fail with a hard error.
2022-12-03 00:53:11 +03:00
Andrey Semashev
84f70b0a2a Added a new test case for absolute() with UNC path on Windows. 2022-12-03 00:01:40 +03:00
Andrey Semashev
8b71cb11a3 Added more fallbacks to directory_iterator construction.
Added ERROR_CALL_NOT_IMPLEMENTED to the list of error codes that are used
to permanently downgrade directory querying method. This error code is
returned by Wine, which up until version 7.21 did not support
FileIdExtdDirectoryRestartInfo and FileFullDirectoryRestartInfo.

Further, use non-permanent downgrade on ERROR_INVALID_PARAMETER. Apparently,
some mounted filesystems don't implement even the older info classes,
such as FileFullDirectoryRestartInfo and FileIdBothDirectoryRestartInfo.
These info classes are otherwise supported by the system and work on other
filesystems.

Lastly, if querying FileIdBothDirectoryRestartInfo fails, fall back to
NtQueryDirectoryFile API.

Fixes https://github.com/boostorg/filesystem/issues/255.
Fixes https://github.com/boostorg/filesystem/issues/266.
Closes https://github.com/boostorg/filesystem/pull/267.
2022-12-02 16:23:24 +03:00
Andrey Semashev
bd878f47e8 Added missing #endif in path_traits.hpp.
Fixes https://github.com/boostorg/filesystem/issues/268.
2022-12-02 12:12:09 +03:00
Andrey Semashev
98c1dd8946 Updated to GHA checkout@v3 to avoid deprecation warnings. boost-1.81.0.beta1 2022-10-18 14:55:26 +03:00
Andrey Semashev
e3bad3c1c6 Explicitly qualify create_directory call to avoid ambiguity in path ctor.
As the compiler considers filesystem::create_directory overload that takes
path as the second argument, if NULL is defined as nullptr the compiler
attempts to construct path from nullptr, which is ambiguous and causes
compilation error. Remove that overload from the overload set by explicitly
qualifying the call.

Reported in https://github.com/boostorg/filesystem/pull/260.
2022-10-18 13:09:50 +03:00
Andrey Semashev
a85778b325 Updated python package installation in GHA config. 2022-09-09 23:52:13 +03:00
Andrey Semashev
db8e65ca52 Fixed LLVM repository URL in GHA config. 2022-09-09 01:38:54 +03:00
Andrey Semashev
fc3f286506 Added clang 14 and 15 CI jobs. 2022-09-09 01:03:41 +03:00
Andrey Semashev
e2d2472eda std::string_view range constructor will be explicit in libstdc++ 11.4.
As noted here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106808
2022-09-08 23:45:18 +03:00
Andrey Semashev
9613ccfa4a std::string_view range constructor was made explicit in gcc 12.2, not 12.1. 2022-09-02 18:27:29 +03:00
Andrey Semashev
cffb1d1bbd Marked path append operators forceinline. 2022-09-02 02:24:47 +03:00
Andrey Semashev
4069ff5ad0 Added C++23 to gcc-11 CI job, added pre-release gcc-12 job. 2022-09-02 02:20:31 +03:00
Andrey Semashev
b224703125 Added a workaround for gcc 11 compile errors in C++23 mode.
C++23 std::string_view added a range constructor that is constrained with
a concept check that in particular checks if the range is contiguous. In
that check, the range iterator type is checked. Since fs::path members now
test whether the source argument is convertible to std::string_view, that
concept check is performed whenever the overload resolution or SFINAE check
is performed. This caused a problem if the check was performed before
fs::path::iterator is defined, since the result of the check formally
changes when the iterator gets defined.

To work around this, move any fs::path non-template member functions that
call to other members (including constructors) which may involve overload
resolution or SFINAE checks that might require testing whether
std::string_view is constructible from fs::path out of fs::path definition
and past the fs::path::iterator definition.

This was also reported to gcc team:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106808
2022-09-02 02:06:01 +03:00
Andrey Semashev
5d4c1caaab Added basic path compare tests. 2022-08-31 23:15:53 +03:00
Andrey Semashev
b219d9fb8a Added support for string views and boost::container::string.
Path traits and relevant path members were reworked to better support
wider range of types that are compatible with path constructors, assignment
and appending members. Added support for C++17 std::string_view,
boost::string_view and boost::container::string as the possible string
types accepted by path members.

Also extended support for types convertible to one of the string types.
Previously, user's type had to be convertible to a string with a character
type that matches the native path character type. Now all supported character
types are acceptable.

Additionally, restricted members accepting a pair of iterators to only accept
iterators whose value types are one of the supported path character types.

Lastly, path::compare and comparison operators now only accept path arguments,
relying on path conversion constructors to do the job of supporting various
source types. Also removed noexcept from compare as it is using lex_compare
and iterators internally and those can throw.

Closes https://github.com/boostorg/filesystem/issues/208.
2022-08-31 09:52:30 +03:00
Andrey Semashev
054b842a58 Added a test for path construction/assignment/appending from a custom string.
This should test path compatibility with user-defined custom string-like types,
including string views.
2022-08-21 19:06:42 +03:00
Andrey Semashev
f540b5a650 Fixed compilation. 2022-08-21 19:01:14 +03:00
Andrey Semashev
349daee54b Moved path_traits.hpp to detail.
The public path_traits.hpp header is deprecated and will be removed. Its
contents are path implementation details and are now in detail.
2022-08-21 18:45:59 +03:00
Andrey Semashev
bb7dc550d5 Removed mentions of u16string and u32string from docs.
Boost.Filesystem does not support char16_t and char32_t yet, so don't
document related types and APIs in the docs.

Related to https://github.com/boostorg/filesystem/issues/86.
2022-08-14 20:08:10 +03:00
Andrey Semashev
2e9e66e843 Marked previously deprecated APIs with attributes to generate warnings.
The warnings can be suppressed by defining BOOST_FILESYSTEM_ALLOW_DEPRECATED
macro when compiling user's code.
2022-08-14 19:52:38 +03:00
Andrey Semashev
d829a46b31 Deprecated path construction/assignment/appending from container types.
Users are advised to use string types and iterators instead of containers
to construct/assign/append to paths.

In v4, the support for containers is removed.
2022-08-14 19:14:42 +03:00
Andrey Semashev
d58eb7a714 Switched gcc-9 to ubuntu-20.04 GHA CI image. 2022-08-14 17:50:38 +03:00
Andrey Semashev
5c8bcc2ba6 Updated copyright years. 2022-08-14 14:02:19 +03:00
Andrey Semashev
7fd03ddcf4 Replaced ubuntu-18.04 GHA CI images with containers.
Also use ubuntu-latest image for jobs that are running in a container.
2022-08-14 13:49:16 +03:00
Andrey Semashev
5864f397cc Fixed a missing include on POSIX systems that don't support *at APIs.
Fixes https://github.com/boostorg/filesystem/issues/250.
2022-08-12 13:01:07 +03:00
Andrey Semashev
476ca7b6c1 Fix weakly_canonical on Windows with long paths prefix.
During its operation, weakly_canonical would call status() on the path
consisting only from the root name of the input path. This would fail
with ERROR_INVALID_FUNCTION if the root name starts with the "\\?\" prefix,
as the root name path is not absolute.

To fix this, we don't check the status of the root name path (which is
not the correct check anyways as it tests the current directory on the
corresponding drive for existence, which is not what we want). Additionally,
avoid calling status() on the paths containing dot and dot-dot elements
during the weakly_canonical execution for the same reason - the "\\?\"
prefix disables most of the path processing in Windows APIs, including
dot and dot-dot elements resolution.

Fixes https://github.com/boostorg/filesystem/issues/247.
2022-08-10 04:57:21 +03:00
Andrey Semashev
1c4e1c01a6 Added a few tests involving Windows long paths. 2022-08-10 01:06:57 +03:00
Andrey Semashev
bf6d461cc7 Use a more appropriate variable name. 2022-08-10 00:36:41 +03:00
Andrey Semashev
bca612381a Moved the last release note to 1.81.0 release.
The relevant fix did not make it to 1.80.0 as it came too late during
the release process.
2022-08-09 20:42:33 +03:00