Commit Graph

1414 Commits

Author SHA1 Message Date
Andrey Semashev
96ff4a1fe6 Corrected comments. 2020-07-28 15:01:45 +03:00
Andrey Semashev
db390391bb Restored auto-linking and Windows CE support.
Auto-linking can still be useful to users of MSVC and compatible
compilers on Windows, when the user links against static build of
Boost.Filesystem. This feature is marked deprecated though, so
it can be removed in the future, when the generated CMake config
files include information about third-party dependencies of Boost
libraries.

Additionally, restored support for linking against Windows CE-cpecific
coredll library. This platform is not tested though and therefore not
properly supported.

Closes https://github.com/boostorg/filesystem/issues/156.
2020-07-28 14:48:42 +03:00
Andrey Semashev
9ea8bfa108 Corrected a typo in release history. 2020-07-16 13:02:42 +03:00
Andrey Semashev
e7c05beebc Added a release note about improving support for Embarcadero compilers. 2020-07-15 00:30:07 +03:00
Andrey Semashev
7e300b986b Corrected system_complete description in the docs.
The updated description refers to absolute operation instead of
complete, which was deprecated and no longer documented in the
reference section. Also, removed a broken link to non-existing
not in the complete docs.

Closes https://github.com/boostorg/filesystem/pull/154.
2020-07-08 17:54:02 +03:00
Andrey Semashev
700a611850 Corrected console output in copy_test. 2020-07-07 17:28:28 +03:00
Andrey Semashev
a5fd89add9 Added a test for copy(ec) operation. 2020-07-07 15:58:59 +03:00
Andrey Semashev
7c4fe07112 Fix copy(ec) operation not copying anything if the target does not exist.
The operation would use (symlink_)status internally to test if the target
file or directory exists. That operation can return an error code even if
it completes successfully. However, copy operation would abort in this case
before attempting to copy anything. This would not be caught by tests because
the tests use the overloads without an error code, and an exception is not
thrown by (symlink_)status in this case.

The fix is to test the returned file status and return if it indicates error.
Also, avoid using the external error code to receive error code from
(symlink_)status to keep it clean if copy operation succeeds.

A similar problem has been fixed in Windows implementation of space operation.

Fixes https://github.com/boostorg/filesystem/issues/152.
2020-07-07 15:49:05 +03:00
Andrey Semashev
d0a7a23a1a Marked windows_file_codecvt as visible instead of dllexport.
windows_file_codecvt is not exported from Boost.Filesystem and is
only used internally. It needs to be visible, where it matters
(which, given that this component is Windows-specific, is probably
nowhere).
2020-07-02 13:40:21 +03:00
Andrey Semashev
1104092053 Extracted platform defines to a separate header and include it everywhere.
This should fix readdir(_r) on 32-bit systems, which was not 64-bit after
commit c758552338 because _FILE_OFFSET_BITS=64
was not defined in directory.cpp. Also, there were filesystem-related system
calls in unique_path.cpp, where the macro was not defined either. Including
the platform header in all source files is useful for possible future changes
that may require the platform-specific macros.

Closes https://github.com/boostorg/filesystem/pull/150.
2020-07-02 13:37:45 +03:00
Andrey Semashev
917f46f9f3 Avoid integer overflow and narrowing conversion in NTSTATUS error codes.
Closes https://github.com/boostorg/filesystem/pull/149.
2020-06-09 14:42:13 +03:00
Andrey Semashev
43dfdc6ac9 Marked bcrypt and advapi32 libs explicit. 2020-06-08 00:35:30 +03:00
Andrey Semashev
a3e517365a Corrected BCrypt API detection check in CMakeLists.txt.
The check depends on Boost.Predef and Boost.WinAPI. Unfortunately,
we cannot use their CMake targets in check_cxx_source_compiles because
they may not yet be defined at the point of inclusion of
filesystem/CMakeLists.txt by the superproject. Thus we have to manually
specify include path to the monolithic include tree. And bcrypt library.

We intentionally do not specify include paths for Boost.Predef and
Boost.WinAPI because that would require to also specify paths of their
dependencies, and this is not an acceptable maintenance burden.
2020-06-05 18:41:23 +03:00
Andrey Semashev
31aacd5dfd Added CMake self-test jobs to CI. 2020-06-05 15:24:10 +03:00
Andrey Semashev
2bfb8c91e1 Corrected configure check for BCrypt API. 2020-06-05 14:17:09 +03:00
Andrey Semashev
e3f29433d9 Updated CMakeLists.txt with configure-time checks required by recent code changes. 2020-06-05 14:00:37 +03:00
Andrey Semashev
49f12dd890 Moved Windows SDK library declarations out of the crypro API selection rule.
This should fix Boost.Build error on Windows.
2020-06-05 13:07:20 +03:00
Andrey Semashev
427697ffcd Check for Cygwin when including Boost.WinAPI. 2020-06-05 12:11:56 +03:00
Andrey Semashev
e75b455a0f Select Windows crypto API on Cygwin as well. 2020-06-05 12:06:15 +03:00
Andrey Semashev
5d1b14df51 Moved Windows lib linking to the Jamfile and added a config check for BCrypt.
This should improve support for Windows compilers that don't support
auto-linking.
2020-06-05 11:58:17 +03:00
Andrey Semashev
5dff490d18 Fixed incorrect pointer adjustment. 2020-06-05 11:22:13 +03:00
Andrey Semashev
7487e33da9 Added unique_path implementation based on BCrypt API on Windows. 2020-06-05 03:17:24 +03:00
Andrey Semashev
5a2568af89 Ported unique_path wincrypt implementation to Boost.WinAPI. 2020-06-05 02:14:30 +03:00
Andrey Semashev
eab0e77f24 Added implementation of unique_path based on arc4random. 2020-06-05 01:40:52 +03:00
Andrey Semashev
e2e4b85ee0 Added unique_path based on Linux getrandom system call.
The new backend is not vulnerable to file descriptor exhaustion attacks.
2020-06-05 01:22:55 +03:00
Andrey Semashev
432f4da6ed Code cleanup in unique_path implementation.
Use the common functions for indicating failure.

In POSIX version, check for EINTR error code when reading from
/dev/(u)random and return the appropriate error code.

On Windows, use the proper type for error code. Also, include
winapi/config.hpp to let Boost.WinAPI define targer Windows version
macros.

Use unsigned types for sizes and indexes.
2020-06-05 01:21:57 +03:00
Andrey Semashev
0b50e1b527 Converted some uses of size() to empty().
c.size() methods were used to test if c was empty in a few places,
so the change is purely for code clarity.

Partly based on https://github.com/boostorg/filesystem/pull/145.
2020-06-05 00:24:59 +03:00
Andrey Semashev
a6eb102f3d Added missing status inspection functions for directory_entry and error_code.
Also, removed incorrect noexcept markup for the overloads not taking error_code.
2020-06-04 23:42:32 +03:00
Andrey Semashev
362696738f Added a release note about fixing is_symlink(directory_entry). 2020-06-04 23:28:55 +03:00
Andrey Semashev
45a9d3160a
Merge pull request #148 from kanje/develop
is_symlink(directory_entry) should use symlink_status().
2020-06-04 23:24:28 +03:00
Antons Jeļkins
5e54f77425 is_symlink(directory_entry) should use symlink_status().
This fixes a problem that is_symlink(directory_entry) always returns
false, even if directory_entry is indeed a symlink. This change makes
is_symlink(directory_entry) behave the same as is_symlink(path) and
use symlink_status().
2020-06-04 21:59:00 +02:00
Andrey Semashev
b52afd7c29 Added a FreeBSD job in Travis CI. 2020-05-31 17:59:55 +03:00
Andrey Semashev
bad98ad954 Added a release note about improving support for WASI platform. 2020-05-23 17:25:22 +03:00
Andrey Semashev
6146fdf161 Use emit_error to unconditionally indicate BOOST_ERROR_NOT_SUPPORTED errors. 2020-05-23 17:22:23 +03:00
Andrey Semashev
b6c3a70689
Merge pull request #144 from whitequark/wasi
Add WASI platform support
2020-05-23 17:17:32 +03:00
whitequark
c34025d5a4 Add WASI platform support.
WASI is a POSIX-like platform that has a few important differences:
  * There is no concept of a mutable current directory.
  * There is no concept of a file mode, and no `chmod` call.
  * There is no concept of a filesystem, and no `statfs` call.
  * There is no `readdir_r` call because there are no threads.
2020-05-23 14:13:46 +00:00
Andrey Semashev
079d372c7c Added gcc 10 build jobs to Travis CI. 2020-05-22 18:48:43 +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
9252269160 Added configuration steps to detect modification time representation in stat.
This should improve compatibility with Mac OS X and other systems with
various representations of file times in struct stat.
2020-05-12 14:56:24 +03:00
Andrey Semashev
16dcdbfa8f Fixed copy_test failures on Windows caused by incorrect symlink target.
The symlink was pointing at a directory rather than a file, which makes a
difference on Windows.
2020-05-12 02:32:36 +03:00
Andrey Semashev
d81944eec4 Added exception handling to copy_test. 2020-05-12 02:08:52 +03:00
Andrey Semashev
cded8ec40c Silence warnings about signed/unsigned mismatch in asserts. 2020-05-11 21:59:13 +03:00
Andrey Semashev
559b0c291a In copy, support symlink creation when target directory is not current.
When the source path is not absolute and copy_options::create_symlinks is
specified, deduce the relative path from the target location to the source
file to create a symlink. This allows to copy to a path that is not the current
path.

Also, added absolute overloads taking error_code argyment.

Also, when current_path() is used as a default argument to other operations,
and the operation also accepts error_code, use current_path(ec) to report
errors through the error code rather than throwing an exception.

Also, added a test for copy operation.
2020-05-11 15:10:23 +03:00
Andrey Semashev
448c145b54 Added copyright. 2020-05-11 00:28:24 +03:00
Andrey Semashev
80709a9411 Reworked copy operation. Added create_directory with two paths.
The updated copy implementation follows C++20 [fs.op.copy] definition
and implements additional copy options.

The new create_directory overloads accepting two paths are functionally
similar to copy_directory, but are compliant with C++20
[fs.op.create.directory]. The copy_directory operation has been deprecated
in favor of create_directory.
2020-05-10 03:02:32 +03:00
Andrey Semashev
4e6317e4b0 Make copy_file return bool, indicating whether file has been copied.
This corresponds to C++20.
2020-05-09 19:38:50 +03:00
Andrey Semashev
ac02dbed2e Added support for copy_options::update_existing to copy_file. 2020-05-09 19:19:33 +03:00
Andrey Semashev
8c3ae354a0 Require at most one copy option to be specified in copy_file. 2020-05-08 22:54:19 +03:00
Andrey Semashev
5d3082b4d4 Use a better highlight for the new feature in release notes. 2020-05-08 19:13:11 +03:00
Andrey Semashev
dea37d899e Added support for copy_options::skip_existing. 2020-05-08 19:09:39 +03:00