Compare commits

...

274 Commits

Author SHA1 Message Date
Steffen Schümann
9fda7b0afb
Update build_cmake.yml, removing macOS build versions not supported by GitHub 2025-01-23 07:26:01 +01:00
Steffen Schümann
076592ce6e
Merge pull request #188 from bbannier/topic/bbannier/getcwd-with-NULL-buf
Avoid GNU `getcwd` extension behavior
2025-01-07 21:00:06 +01:00
Steffen Schümann
157feb3651
Merge pull request #190 from dpogue/wundef-fix
Check macros are defined before use
2025-01-05 17:01:49 +01:00
Darryl Pogue
f08e8b0064
Check macros are defined before use
This resolves warnings when compiling with -wundef (and errors when
combined with -werror).
2025-01-04 21:45:29 -08:00
Benjamin Bannier
99c3500205 Replace EOL centos CI with rockylinux
centos7 has reached EOL on 2024-06-30, centos8 on 2021-10-31. In
practical terms this means that their package repositories are offline
for the foreseeable future and the CI tasks making use of them might
never run again.

This patch replaces the existing CI jobs on centos7/centos8 with jobs on
rockylinux8/9. Since rockylinux is an open source variant similar to
RHEL this should provide testing with similar spirit. In contrast to
centos, rockylinux does provide very granular tagging of releases which
if used would help avoid breaking on e.g., subtle package changes in
their package repositories. I however did not use very precise tags in
the patch and instead went with broad "trains" for the 8 and 9 series;
I hope this minimizes maintenance overhead (e.g., bumping to new
releases) while still giving a good testing signal.
2024-12-18 15:45:33 +01:00
Benjamin Bannier
f43846877b Avoid GNU getcwd extension behavior
GNU `getcwd` can allocate a buffer if passed `NULL` for it. This is an
extension which is e.g., not recognized by clang-tidy-19's
`StdCLibraryFunctions` check[^1] which emits a diagnostic on a violated
precondition `buf != NULL`,

```
The 1st argument to 'getcwd' is NULL but should not be NULL [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors]
[build]  3987 |     std::unique_ptr<char, decltype(&std::free)> buffer{::getcwd(NULL, 0), std::free};
```

This patch modifies this use of `getcwd` with this extension behavior to
instead use `get_current_dir_name` which is also a GNU extension, but
does not trigger this diagnostic.

[^1]: https://clang.llvm.org/docs/analyzer/checkers.html#unix-stdclibraryfunctions-c
2024-12-18 15:26:19 +01:00
Steffen Schuemann
b1982f06c8 work on ci scripts 2024-04-27 12:20:18 +02:00
Steffen Schuemann
fbc5d213fc work on ci scripts 2024-04-27 12:07:57 +02:00
Steffen Schuemann
72a03b3c6d work on ci scripts 2024-04-27 12:00:20 +02:00
Steffen Schuemann
9fe68b91c7 work on ci scripts 2024-04-27 10:41:56 +02:00
Steffen Schuemann
56776c92f7 work on ci scripts 2024-04-27 09:58:19 +02:00
gulrak
42ea4fc615
Merge pull request #179 from vgeorgiev/lexically_relative_fix
Fix lexically_relative return when base path evaluates to *this
2024-02-29 07:55:33 +01:00
vgeorgiev
eeed314237
Fix handling of trailing slash 2024-02-21 17:55:00 -06:00
vgeorgiev
768b5cb11b
Fix lexically_relative return when base path evaluates to *this 2024-02-21 11:07:19 -06:00
gulrak
2fc4b46375
Merge pull request #177 from noexcept/master
fix infinite loop when errno is EINTR
2024-01-01 21:48:11 +01:00
noexcept
fc19b58459 fix infinite loop when errno is EINTR 2023-12-20 11:56:57 +00:00
gulrak
f19cbbbd31
Merge pull request #176 from cpsauer/patch-1
Add reference to Bazel rules
2023-11-16 18:08:10 +01:00
Chris Sauer
0ef214a7a0
Add reference to Bazel rules 2023-11-15 14:18:03 -08:00
gulrak
fcea331ebb
Merge pull request #174 from bugdea1er/remove-debug-info
Removed debug information from CMakeLists.txt
2023-09-16 10:11:14 +02:00
gulrak
1ab54e53cc
Merge pull request #172 from rikyoz/glibcxx_wchar_streams
Allow wchar_t constructors of fstreams on Windows when using libstdc++
2023-09-16 10:09:38 +02:00
bugdea1er
58e983167c Removed debug information from CMakeLists.txt 2023-09-11 14:54:59 +03:00
Oz
c4683aa4a1
Allow wchar_t constructors of iostreams on Windows when using libstdc++ 2023-09-05 09:00:51 +02:00
gulrak
144954ff4e
Merge pull request #167 from cpsauer/dynamic-selection-more-apple-platforms 2023-07-30 19:40:45 +02:00
Chris Sauer
48d46cccef Improve apple conditionals in filesystem.hpp
Two changes:
- (minor) Rename GHC_OS_MACOS -> GHC_OS_APPLE, since it is defined all apple platforms (iOS, watchOS, etc.), not just macOS.
- Changed the preprocessor conditional in last_write_time to align with its presumed intent. Previously, it would always have been true, which can't be intentional, because the *_OS_VERSION_MIN_REQUIRED is undefined and thus zero for platforms besides the current one, and therefore less than the constants--except for on very old SDKs where, e.g., MAC_OS_X_VERSION_10_13  and others would be undefined and therefore 0 and therefore making the clause false when it needed to be true. Therefore, I changed the conditions to be parallel to those in the dynamic selection headers, checking for the undefined, zero case and hardcoding the version values to support old SDKs.
2023-07-26 23:07:09 -07:00
Chris Sauer
23710d3b56 Remove conditional inclusion snippet in filesystem.hpp
Reduces duplication and tendency to get out of sync.
As evidence of the problem, the snippet had previously (before this PR) started to diverge. It seemed more prudent to delete than to fix, given the usage instructions seem to be centralized in the readme and the dynamic selection headers should probably be recommended anyway.
2023-07-26 21:56:08 -07:00
Chris Sauer
64f9c5a61a Switch internal includes to quoted relative
This makes project integration more flexible, allowing the drag-contents-of-directory project integration contemplated in the readme and allowing use via -iquote
2023-07-26 21:40:38 -07:00
Chris Sauer
a55c96a2ba Minor: seperated typo 2023-07-26 21:28:52 -07:00
Chris Sauer
aaaf381d9d Improvements to preprocessor conditions for falling back to std::filesystem
- Supports more Apple platforms, including future ones, which will always support std::filesystem, like with visionOS
- Simplifies cases.  Undefined preprocessor values are guaranteed to default evaluate to 0
- Moves <Availability.h> include inside conditional, avoiding the include where not needed.
- Removes reference to wchar for std headers on windows, which seemed to be out of date, since the define it might have been referring to was commented
- (And some other small things.)
2023-07-26 21:26:33 -07:00
Steffen Schuemann
72a76d774e head version bumped to wip version 2023-05-18 10:39:25 +02:00
Steffen Schuemann
e5ae1bd3e3 refs #166, ".." does not have extension ." 2023-05-17 07:18:52 +02:00
Steffen Schuemann
8a2edd6d92 Version bump to v1.5.14 2023-03-05 13:06:50 +01:00
gulrak
e9e32f8830
Merge pull request #161 from stilllman/cmake-alias-target
[cmake] Define alias ghcFilesystem::ghc_filesystem unconditionally
2023-03-05 12:22:04 +01:00
gulrak
9f61ee0eb5
Merge branch 'master' into cmake-alias-target 2023-03-05 11:17:55 +01:00
Steffen Schuemann
d1f0d79054 updated README.md 2023-03-04 16:42:22 +01:00
Steffen Schuemann
61176cd82a Merge branch 'feature-146-added-EINTR-handling' 2023-03-04 16:39:33 +01:00
Steffen Schuemann
78b746d901 update README.md 2023-03-04 15:19:18 +01:00
Steffen Schuemann
9df22d5396 refs #157, suppress unavoidable warning at cast for GetProcAddress on MSVC 2023-03-04 15:17:13 +01:00
Steffen Schuemann
9ffca3839f Updated README.md 2023-03-04 12:52:41 +01:00
Steffen Schuemann
2a81c2c355 refs #160, only enable install target by default if not subproject as documented 2023-03-04 12:43:22 +01:00
Steffen Schuemann
e3341b2f64 refs #146, fix mingw build issue 2023-03-04 12:03:12 +01:00
Steffen Schuemann
6a94e84da4 refs #151, stop throwing on fs:🇩🇪:refresh for broken symlinks, and added test 2023-03-04 09:59:16 +01:00
Steffen Schuemann
a7a6d930fb Updated README.md 2023-03-03 23:43:08 +01:00
Steffen Schuemann
7da9be91c9 test for permission copying 2023-03-03 23:42:44 +01:00
gulrak
e6b34e29bf
Merge pull request #149 from dvzrv/declare_version
Declare and export version from CMake
2023-03-03 17:49:35 +01:00
gulrak
b1ff2ce95e
Changed version to in-between releases version 1.5.13
As the master version is on that number it avoids confusion.
2023-03-03 17:48:35 +01:00
gulrak
3afbd9c315
Merge pull request #144 from actboy168/patch-2
copy_file also copies permissions
2023-03-03 17:35:47 +01:00
gulrak
de64decd91
Merge pull request #143 from actboy168/patch-1
Fixes skip_existing on fs::copy
2023-03-03 17:31:15 +01:00
gulrak
f3c1058928
Update CMakeLists.txt
The projects compatibility rule is that minor changes can be api changes, so I changed it to SameMinorVersion.
2023-03-03 06:53:13 +01:00
Steffen Schuemann
f3033c29fb refs #146, added EINTR handling to directory iteration and file copying 2023-03-03 06:44:58 +01:00
Steffen Schuemann
4041174f96 Disabled the defunct drone build. 2023-03-02 19:46:12 +01:00
Steffen Schuemann
c8113e14b1 Updated readme, bumped to wip version as preparation of upcoming release. 2023-03-02 19:19:22 +01:00
Steffen Schuemann
b6d302f5b9 Merge branch 'feature-156-posix-issue-stem-filename-extension' 2023-03-02 19:01:15 +01:00
Steffen Schuemann
efc077f553 refs #156: Windows path handling artifact bled into POSIX 2023-03-02 08:20:18 +01:00
gulrak
bc05cc59f4
Merge pull request #163 from Begasus/haiku
filesystem.hpp, add support for Haiku
2023-02-20 07:35:34 +01:00
begasus
a9c18e0880 Fix Haiku build 2023-02-19 14:17:05 +01:00
begasus
9afb43851d filesystem.hpp, add support for Haiku 2023-02-18 10:21:53 +01:00
gulrak
c57242b4bc
Merge pull request #154 from sthibaul/master
Fix build on GNU/Hurd
2023-02-17 17:29:41 +01:00
gulrak
3337cc252a
Merge pull request #153 from kkaefer/last_write_time-ios
Fix `ghc::filesystem::last_write_time()` setter on iOS/tvOS/watchOS
2023-02-17 17:27:12 +01:00
gulrak
655b0b354a
Merge pull request #162 from Qrox/patch-1
Fix directory iterator treating all files subsequent to a symlink as symlink on Windows
2023-02-17 17:23:38 +01:00
Jianxiang Wang (王健翔)
f0caeb7d58
Update filesystem.hpp
Fix directory iterator treating all files subsequent to a symlink as symlink on Windows
2023-02-16 13:38:48 +08:00
Luc Touraille
6c6f2c2ec0 [cmake] Define alias ghcFilesystem::ghc_filesystem unconditionally
This alias is needed whether or not the install rules of `ghcfilesystem`
are enabled. It allows projects to use the same target regardless of
where `ghcfilesystem` comes from, `add_subdirectory` or `find_package`.
2023-01-11 09:10:27 +01:00
gulrak
3e5b930d96
Merge pull request #145 from CookiePLMonster/y2038-fix
Fix a Y2038 bug in timeToFILETIME
2022-11-18 09:27:04 +01:00
Samuel Thibault
d3d968e583 Fix build on GNU/Hurd
There is no path length limitation there, even via pathconf.  But glibc
provides a getcwd function that allocates the buffer dynamically so we can
just leverage that.
2022-08-16 20:29:54 +02:00
Konstantin Käfer
404c57f1b0 Fix ghc::filesystem::last_write_time() setter on iOS/tvOS/watchOS
The previous implementation tried to detect old deployment targets for macOS that doesn't have the newer `utimensat` call. Unfortunately, it would just detect macOS, and didn't check for the corresponding iOS/tvOS/watchOS version numbers. On those platforms, last_write_time() was effectively a no-op, failing silently and not modifying the mtime of the file.

This patch adds detection for these platforms. It also removes the special casing when newer versions of macOS/iOS/tvOS/watchOS are used as the deployment targets, and instead folds it into the default POSIX branch.
2022-07-27 18:31:16 +02:00
David Runge
4c33b91fe9
Write ghc_filesystem-config-version.cmake file
CMakeLists.txt:
Write a ghc_filesystem-config-version.cmake file and install it, so that
other projects may rely on the exact version of ghc_filesystem.
The compatibility mode implies, that any version of ghc_filesystem with
the same major version is feature compatible.
2022-06-10 16:42:01 +02:00
David Runge
089ef64aa3
Declare version in cmake project() call
CMakeLists.txt:
Declare the project's version in the cmake project() call so that it may
be exported to the project's cmake integration (used by other projects).
2022-06-10 15:59:22 +02:00
Silent
4f0824fd76
Fix a Y2038 bug in timeToFILETIME
The old code truncated time_t to a 32-bit value
when using Int32x32To64. This example code has been fixed
on MSDN a while ago, so this change only updates it to
the current version.

More on this issue:
https://cookieplmonster.github.io/2022/02/17/year-2038-problem/
2022-05-25 19:56:56 +02:00
actboy168
28f7c929e0
fixes 2022-04-08 11:43:15 +08:00
actboy168
ab8a78d806
copy_file also copies permissions 2022-04-08 11:18:01 +08:00
actboy168
f6d7d5b826
Fixes skip_existing 2022-04-08 10:32:41 +08:00
Steffen Schuemann
cd6805e94d Version bump release v1.5.12
Took 30 minutes
2022-04-03 11:40:58 +02:00
Steffen Schuemann
6cc60fb687 Updated README.md
Took 45 seconds
2022-04-02 19:37:43 +02:00
Steffen Schuemann
fb4bb2b764 refs #138, ensure PATH_MAX exists on POSIX backend, wip version bump
Took 4 minutes
2022-04-02 19:36:58 +02:00
Steffen Schuemann
c4907cc681 Merge branch 'master' of github.com:gulrak/filesystem
# Conflicts:
#	test/CMakeLists.txt

Took 30 minutes
2022-04-02 19:33:55 +02:00
gulrak
5d1d579048
Merge pull request #140 from phprus/cxx20-deprecated
refs #140, disable ``deprecated-declarations`` warning in tests (C++20)
2022-04-02 19:24:23 +02:00
Steffen Schuemann
7fa1bde113 Merge branch 'feature-142-dirent-on-solaris' 2022-04-02 19:06:30 +02:00
Steffen Schuemann
7a53650e73 refs #142, switch Centos 8 source
Took 4 minutes
2022-04-02 16:29:03 +02:00
Steffen Schuemann
1ae0195287 refs #142, fix windows workflow
Took 5 minutes
2022-04-02 15:08:04 +02:00
Steffen Schuemann
e5bbc754e7 refs #142, fix tests
Took 2 minutes
2022-04-02 13:55:10 +02:00
Steffen Schuemann
977e5d6284 refs #142, solaris support for tests
Took 2 minutes
2022-04-02 13:53:16 +02:00
Steffen Schuemann
723c787b9e refs #142, solaris support for tests
Took 3 minutes
2022-04-02 13:51:20 +02:00
Steffen Schuemann
91e71f7f54 refs #142, solaris support for tests
Took 51 minutes
2022-04-02 13:47:16 +02:00
Steffen Schuemann
c4b507e9d8 refs #142, autodetect dirent::d_type and add GHC_OS_SOLARIS detection
Took 3 hours 8 minutes
2022-04-02 11:40:50 +02:00
Vladislav Shchapov
e8a17c1319 Migrate to Centos 8 Stream 2022-02-07 19:42:09 +05:00
Vladislav Shchapov
d4e12344d6 Fix C++20 test errors 2022-02-07 18:42:49 +05:00
gulrak
f437344e79
Merge pull request #137 from chewi/master
Update Catch header to v2.13.7 to fix tests against glibc 2.34
2021-11-27 21:32:56 +01:00
James Le Cuirot
f0467f4384
Update Catch header to v2.13.7 to fix tests against glibc 2.34 2021-11-22 22:34:41 +00:00
Steffen Schuemann
a07ddedeae Adding macos-11 to the tested platforms.
Took 17 minutes
2021-10-24 09:27:42 +02:00
Steffen Schuemann
614bbe87b8 Release v1.5.10 version bump
Took 25 minutes
2021-10-23 16:08:12 +02:00
gulrak
09908b7241
Merge pull request #136 from phprus/win-smart-ptr
Performance optimization for Windows.
2021-10-23 15:50:33 +02:00
Владислав Щапов
1dbe2d9bec Replace std::shared_ptr<void> to unique_handle 2021-10-03 19:28:53 +05:00
Владислав Щапов
7b8cf519f2 Replace std::shared_ptr to std::unique_ptr 2021-10-03 19:28:53 +05:00
Владислав Щапов
d279a4f73d Apply clang-format 2021-10-03 18:15:55 +05:00
gulrak
97d7fa8d10
Merge pull request #135 from phprus/issue-132
Fix for issue #132
2021-10-01 07:42:52 +02:00
Владислав Щапов
1f3943b1c4 Fix ghc::filesystem::remove_all behavior if argument is symlink 2021-09-23 00:55:09 +05:00
Владислав Щапов
6a835afddf Update CI 2021-09-23 00:55:09 +05:00
gulrak
7bc5c17305
Merge pull request #133 from musicinmybrain/space-overflow
Cast to uintmax_t *before* multiplying in space calculations
2021-07-31 00:11:22 +02:00
Benjamin A. Beasley
924d84acf0 Cast to uintmax_t *before* multiplying in space calculations
This ensures that all cases where the result actually does fit in a
uintmax_t are correctly handled. Before, the multiplication could be
performed in a smaller type, leading to an incorrect result or, worse,
undefined behavior due to signed integer overflow.

This fixes a test failure that was actually observed on an i686 Linux
system.
2021-07-30 17:14:23 -04:00
Steffen Schuemann
d87ac130cf Squashed commit of the following:
commit 2bef80eec1fe16a23e34143b9a5a32b04d612ed2
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 20:11:36 2021 +0200

    wip

commit e8c063d7ea66d2bdcbd1535b12dac1ca24afc7b9
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 20:05:04 2021 +0200

    wip

commit aafdebf274cafacfd6e1472621b015e48d547412
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 19:50:39 2021 +0200

    wip

commit b36f13655a09c3bac62afc6079ba010eb934493d
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 18:05:35 2021 +0200

    wip

commit eee191875c0d6816022342d341eaa43f5f83c4ff
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 17:32:35 2021 +0200

    more wip

commit 0ff949ab5f21055298aee8d7fcdda3a10f61a69c
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 17:12:18 2021 +0200

    wip

commit ca68861cb4c4e14079bb3ab2e0c9725b0a3aece8
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 16:31:32 2021 +0200

    wip

commit e188a3d2cca4f4bb84c3fa8f49e5de34ec731713
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 16:21:51 2021 +0200

    wip

commit b8383ac22cdb5bab3a4f527a1c46dafd009b2f11
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 16:15:42 2021 +0200

    Workflow wip...

commit 162416fe2cf2922382c7c7fd34c648b4782d48be
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 15:57:31 2021 +0200

    Workflow wip...

commit 891be4cdd72b23ec86bdc0935d9201841c2c07bc
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 15:52:24 2021 +0200

    Workflow wip...

commit 5c2ee653f41a38858cfaf602df639276ae1c7fbb
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 15:44:59 2021 +0200

    Workflow wip...

commit bca8df081885aed67ce0952f20aa2e4a96072a04
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 15:40:23 2021 +0200

    Workflow wip...

commit d94d8de098d954bffae65aec789d72c5c0b1301b
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun Jul 4 15:34:16 2021 +0200

    Workflow wip...

commit 19f301992b733e699054050fdf552c982fea300c
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sat Jul 3 21:54:11 2021 +0200

    Workflow wip...

commit 495457726fc844d014e49b56acd6367160f4322b
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sat Jul 3 18:38:04 2021 +0200

    workflow wip

commit fde42cd4a5f865807703ff6814d9d0e8dfbde030
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sat Jul 3 18:34:47 2021 +0200

    Testing more generic workflow.

commit ead40cc153814e23ef3ddcb654ed8c57c10f54a6
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sat Jul 3 16:51:25 2021 +0200

    Work on using GitHub workflows.
2021-07-04 20:24:13 +02:00
Steffen Schuemann
1d3d5f5d7d Version bump and updated readme. 2021-06-14 22:16:54 +02:00
Steffen Schümann
6fad24ecb9 Updated readme. 2021-06-14 21:36:44 +02:00
Steffen Schümann
b3d9a50bb5 Removed unwanted generation of temp strings. 2021-06-14 21:34:37 +02:00
Steffen Schümann
cd68567543 Bump wip version 2021-06-14 21:31:44 +02:00
Steffen Schümann
15e814e820 refs #125, fix broken windows long path test and broken create_directories with prefixed long paths 2021-06-10 01:21:07 +02:00
Steffen Schuemann
4e21ab3057 Version bump and updated readme. 2021-05-24 10:09:27 +02:00
Steffen Schuemann
a0e5e43c90 Merge branch 'feature-116-better-support-for-systems-without-dirent-d_type' 2021-05-24 10:03:20 +02:00
Steffen Schuemann
c029736d27 Updated readme. 2021-05-24 09:55:50 +02:00
Steffen Schuemann
19d0c63c29 refs #116, systems without d_type can now use GHC_NO_DIRENT_D_TYPE to compile, experimental QNX support 2021-05-24 09:30:42 +02:00
Steffen Schuemann
e402bad9b8 Merge branch 'master' of github.com:gulrak/filesystem 2021-05-23 16:31:57 +02:00
Steffen Schümann
51d62f88bb Fix for merge error and failing impl_test compile. 2021-05-23 16:27:54 +02:00
Steffen Schuemann
231b64fec0 Merge branch 'feature-122-recursive-iterator-follows-dead-symlinks'
# Conflicts:
#	README.md
2021-05-23 16:21:08 +02:00
Steffen Schuemann
31665c040a Updated readme. 2021-05-23 16:19:37 +02:00
Steffen Schümann
70cf2f03ba Merge branch 'feature-124-mapped-volumes-wrongly-handled-as-symlinks' 2021-05-23 16:06:13 +02:00
Steffen Schümann
d0b13bbc8e Merge branch 'feature-121-remove-handling-of-read-only-entires' 2021-05-23 15:58:55 +02:00
Steffen Schümann
05a41f6dae refs #123, build tests with WIN32_LEAN_AND_MEAN to ensure this keeps working 2021-05-23 15:55:47 +02:00
Steffen Schümann
9c6ff202e7 refs #121, fix for mingw compile issue 2021-05-23 11:29:04 +02:00
Steffen Schümann
a697b05dd7 refs #121, allow fs::remove on read-only entries in windows too 2021-05-23 10:53:58 +02:00
Steffen Schümann
cf4e05d42f refs #124, fix for mingw compile issue 2021-05-23 10:05:47 +02:00
Steffen Schümann
e51e6ee46b refs #124, mapped folder/volumes where wrongly handled as symlinks, failing fs::canonical 2021-05-23 08:46:50 +02:00
Steffen Schuemann
873a55addf refs #122, fix for dead symlink iteration error 2021-05-22 07:14:47 +02:00
Steffen Schümann
7e009bcf6f refs #122: added test that iterates over dead symlinks 2021-05-22 06:37:52 +02:00
Steffen Schuemann
e65a6baf76 Updated readme. 2021-05-02 23:14:52 +02:00
Steffen Schuemann
37442cc5ea refs #119, add additional tests and missing character literal types support 2021-05-02 01:46:08 +02:00
gulrak
134dffdcbd
Merge pull request #117 from phprus/gcc-libstdcxx-version
libstdc++ version check.
2021-04-26 18:43:57 +02:00
gulrak
777e3c9a34
Merge pull request #118 from phprus/test-root-unix
Disable some tests if running on root.
2021-04-26 18:42:24 +02:00
Владислав Щапов
22d1133ea5 Disable some tests if running on root. 2021-04-24 01:41:07 +05:00
Владислав Щапов
b9faee7f5d libstdc++ version check. 2021-04-24 01:08:48 +05:00
gulrak
7fb50217da
Merge pull request #115 from phprus/experimental-string_view
Improved string_view support (v2)
2021-04-20 22:29:20 +02:00
Владислав Щапов
6ab0cb2844 - Detect libstdc++ from gcc-5 and never. 2021-04-18 20:41:50 +05:00
Steffen Schuemann
fc875735dd Updated readme. 2021-04-06 12:09:32 +02:00
Steffen Schuemann
6dc4ece24b refs #114, use Availability.h in supporting headers 2021-04-03 12:24:48 +02:00
Steffen Schuemann
494e751709 refs #113, removed square brackets from test names to fix ctest/catch2 issue 2021-03-27 14:26:55 +01:00
Steffen Schuemann
76c3966df4 refs #113, switched to tag based comments and test names instead of C++17 paragraph numbers to become more standard version agnostic 2021-03-27 09:22:04 +01:00
Steffen Schuemann
2a8b380f8d Release v1.5.4 2021-03-21 19:13:43 +01:00
gulrak
c29d535bb5
Merge pull request #112 from albert-github/feature/bug_spell
Spelling checking corrections
2021-03-21 13:49:33 +01:00
albert-github
865f09be7b Spelling checking corrections
A number of spelling errors, layout errors etc.
2021-03-21 11:58:37 +01:00
Steffen Schuemann
fd9bb43015 Merge branch 'feature-111-further-directory-iteration-optimization' 2021-03-21 10:38:09 +01:00
Steffen Schuemann
9092e09c99 Updated readme. 2021-03-21 10:37:45 +01:00
Steffen Schuemann
1037c02950 Removing indirect refresh calls on directory_entry on posix
removing redundant path instance from windows directory_iterator implementation
2021-03-20 20:41:01 +01:00
Steffen Schümann
b82066f27e refs #110, first cygwin support 2021-03-20 18:01:02 +01:00
gulrak
d768b60d49
Merge pull request #109 from albert-github/feature/bug_filesystem_spell
Correcting spelling errors
2021-03-19 19:55:55 +01:00
gulrak
b8cff0c99c
Merge pull request #108 from philbucher/patch-1
using static_cast instead of old style cast
2021-03-19 19:53:31 +01:00
albert-github
828062889a Correcting spelling errors
Correcting spelling errors
2021-03-19 12:20:32 +01:00
Philipp Bucher
67e708cc4f
using static_cast instead of old style cast
This is a warning in GCC when using -Wold-style-cast
2021-03-18 14:57:10 +01:00
Steffen Schuemann
399941fe55 Updated readme. 2021-03-14 11:31:56 +01:00
Steffen Schuemann
8d45dc4d41 refs #107, fix handling of inaccessible symlink target errors 2021-03-14 10:45:10 +01:00
gulrak
0858444609
Merge pull request #106 from phprus/cmake-appleclang
Fixed detection of the AppleClang compiler
2021-03-14 08:24:25 +01:00
Владислав Щапов
7b6b600fd1 Fixed detection of the AppleClang compiler. 2021-03-12 15:55:43 +05:00
Steffen Schuemann
b15977a05a refs #105, wip version bump and updated readme. 2021-03-06 08:26:41 +01:00
gulrak
dbf882b124
Merge pull request #105 from phprus/test-options
Added options for testing
2021-03-06 08:16:30 +01:00
Владислав Щапов
6033320a1a Added options for testing 2021-03-05 22:04:53 +05:00
gulrak
2a7ebf36c0
Update README.md 2021-02-28 09:31:27 +01:00
Steffen Schuemann
f86be09be3 Release v1.5.2 2021-02-27 20:49:48 +01:00
Steffen Schuemann
f37cdd5af5 Merge branch 'feature-104-posix-iterator-performance' 2021-02-27 17:51:53 +01:00
Steffen Schuemann
264445eaee refs #104, fixing last half-commit 2021-02-22 23:40:39 +01:00
Steffen Schuemann
5c02ca36b4 refs #104, fixed noexcept inconsistency 2021-02-22 23:31:56 +01:00
Steffen Schuemann
8a19af1f63 refs #104, performance related refactoring 2021-02-22 23:13:44 +01:00
gulrak
bc69aa355c
Merge pull request #103 from phprus/unix-wchar_t
Enabled wchar_t path Source on UNIX
2021-02-22 22:52:21 +01:00
Владислав Щапов
f98478c33b Enabled wchar_t path Source on UNIX 2021-02-21 21:57:27 +05:00
gulrak
0e5f2f5d1b
Merge pull request #102 from phprus/string_view
Improved string_view support
2021-02-20 09:44:51 +01:00
Владислав Щапов
b78b0239a3 Improved string_view support 2021-02-17 18:41:26 +05:00
Steffen Schuemann
daf0e7dfbf Updated readme to wip changes. 2021-02-16 08:45:33 +01:00
gulrak
34fe1e314a
Merge pull request #101 from phprus/encoding
Removed duplicate encoding conversion
2021-02-16 08:21:19 +01:00
Владислав Щапов
011e039c4b Removed duplicate encoding conversion 2021-02-15 22:15:26 +05:00
Steffen Schuemann
799fcb4d4d Merge branch 'feature-97-test-hard-link-count' 2021-02-13 08:51:39 +01:00
Steffen Schuemann
31ea91b7bd refs #97, signed/unsigned warning in test 2021-02-13 05:47:37 +01:00
Steffen Schuemann
57f3186ee2 refs #97, on posix backend hard links tests are now validated against lstat result to support results from btrfs 2021-02-13 05:08:24 +01:00
gulrak
0d109a7666
Merge pull request #98 from phprus/glibc-less-2.17
Link with -lrt (for glibc versions before 2.17)
2021-02-12 08:52:13 +01:00
Владислав Щапов
402f462062 Link with -lrt (only for glibc versions before 2.17) 2021-02-11 23:51:11 +05:00
gulrak
77a8df068d
Merge pull request #96 from phprus/custom-api-spec
Allow customization of export attributes
2021-02-11 08:19:16 +01:00
Steffen Schuemann
88f9c3613a wip version bump 2021-02-11 08:15:17 +01:00
Владислав Щапов
2dbb71acae Allow customization export attributes. 2021-02-10 20:14:18 +05:00
Steffen Schümann
2298e68d5c refs #95, fix MSVC warning syntax 2021-02-10 08:04:06 +01:00
Santiago Ospina De Los Ríos
0f6f0af4b4
Fix config installation (#93)
* Export and install targets and config file

* Add alias

* Fix install dir

* Install config file

* Switch to a searchable path
2021-02-08 21:49:36 +01:00
Steffen Schuemann
3d3c02ce35 Version bump and updated readme. 2021-02-07 14:07:06 +01:00
Steffen Schuemann
9970d3354f Fixed unused parameter isse. 2021-02-07 13:20:28 +01:00
Steffen Schuemann
306ad540ed Updated readme. 2021-02-07 12:14:10 +01:00
Steffen Schuemann
967c563d07 Merge remote-tracking branch 'origin/feature-90-native-format-backend' 2021-02-07 11:57:55 +01:00
Steffen Schuemann
c1fcd93c29 Merge branch 'feature-91-cmake-option-fix' 2021-02-07 11:54:45 +01:00
Steffen Schuemann
8353715199 Merge branch 'feature-89-file_status-equal-op' 2021-02-07 11:53:19 +01:00
Steffen Schümann
fdf5bb0179 refs #90, made wchar_t/wstring default on Windows 2021-02-07 10:02:12 +01:00
Steffen Schuemann
05f0aa8ae1 refs #89, fixing some test code issues 2021-02-07 09:59:06 +01:00
Steffen Schuemann
4e0a591a59 refs #91, fixing option handling to actually allow overriding from parent projects. 2021-02-07 09:44:19 +01:00
Steffen Schümann
9e3d42fd72 refs #90, avoid unneeded conversions when using wchar_t backend 2021-02-06 14:32:14 +01:00
Steffen Schuemann
75c647f327 refs #90, small optimizations 2021-02-06 12:49:16 +01:00
Steffen Schümann
ff271edfee refs #90, fix some mingw compile issues 2021-02-06 09:10:55 +01:00
Steffen Schümann
6699f6a3da refs #90, initial support of wstring as backend storage of path 2021-02-01 00:34:09 +01:00
Steffen Schuemann
3eddea2ea8 refs #90, switch from internal_separator to preferred_separator use after refactoring 2021-01-31 13:36:50 +01:00
Steffen Schuemann
4944a87e18 refs #90, additional compile issue fixes 2021-01-31 13:04:14 +01:00
Steffen Schuemann
a7abc2ad4a refs #90, fixing stuff broken on POSIX side during backend rework. 2021-01-31 12:03:17 +01:00
Steffen Schümann
c96b0059c3 refs #90, native path backend - stage two, prefix handling repaired and configurable, all tests working on Windows (wchar_t backend will be stage 3) 2021-01-31 11:39:48 +01:00
Steffen Schümann
8fac7e5254 refs #90, first stage of backend rework done, tests besides namespaced/prefixed long filenames working with char value_type again 2021-01-24 12:57:58 +01:00
Steffen Schümann
b869b9fc4b refs #90, work on switching from generic_format backend to (normalized) native_format backend 2021-01-23 11:19:30 +01:00
Steffen Schuemann
973abff4b9 refs #89, added operator==() to fs::file_status 2021-01-21 19:01:42 +01:00
Steffen Schuemann
de57485877 refs #88, updated readme and bumped to wip version 2021-01-21 09:14:57 +01:00
Steffen Schuemann
0dde29d260 Merge branch 'feature-88-parent_path-performance' 2021-01-21 09:08:19 +01:00
Steffen Schuemann
6bf13c0ce1 refs #88, fix signed/unsigned issue 2021-01-21 00:23:15 +01:00
Steffen Schuemann
9206877fc8 refs #88, work on path::parent_path() optimization 2021-01-21 00:06:35 +01:00
Steffen Schuemann
8166dd1546 Release v1.4.0 2020-12-31 10:37:49 +01:00
Steffen Schuemann
fed499b543 Merge branch 'feature-cpp20-support' 2020-12-31 10:33:42 +01:00
Steffen Schuemann
56c58756aa Small update to cirrus test script. 2020-12-30 11:37:36 +01:00
Steffen Schümann
06433ccb3c refs #71, fixing windows u8 literal test issue 2020-12-30 11:33:15 +01:00
Steffen Schuemann
5bf0d440e7 refs #71, fix warning disable syntax for msvc 2020-12-29 17:00:38 +01:00
Steffen Schuemann
3225d122ac refs #71, added three-way comparison to directory_entry 2020-12-28 23:20:32 +01:00
Steffen Schuemann
ab3cb84648 refs #71, trying to silence deprectated errors 2020-12-28 02:14:39 +01:00
Steffen Schuemann
45d36a8e19 refs #71, work on compilation issues on Windows 2020-12-28 01:07:16 +01:00
Steffen Schuemann
0282098c13 refs #71, work on readme and compile errors 2020-12-28 00:44:43 +01:00
Steffen Schuemann
3629ba96e5 refs #71, C++20 support, some overdue cleanup-work, to enhance readability. 2020-12-28 00:08:16 +01:00
Steffen Schuemann
5b5b529398 Merge branch 'master' into feature-cpp20-support 2020-12-27 18:44:22 +01:00
Steffen Schuemann
dc8eb2d004 Updated readme. 2020-12-27 13:44:29 +01:00
Steffen Schuemann
3ad9525acc Release v1.3.10 2020-12-27 13:29:15 +01:00
Steffen Schuemann
b3451220ca refs #71, work on c++20 api changes 2020-12-27 02:20:55 +01:00
Steffen Schuemann
d2100b431f refs #71, restarted wip on C++20 support 2020-12-27 00:03:57 +01:00
Steffen Schuemann
011659ff75 Updated readme. 2020-12-26 17:43:08 +01:00
Steffen Schuemann
9c83cc14ff Merge branch 'feature-81-string-view-support' 2020-12-26 17:41:07 +01:00
Steffen Schuemann
0962f46650 refs #81, remove usage of string_view literal due to vs2017 issue 2020-12-26 16:57:13 +01:00
Steffen Schuemann
eef2c2ba55 refs #81, work on incomplete string_view support when using c++17 2020-12-26 15:14:32 +01:00
Steffen Schuemann
97577f4c3b Updated readme. 2020-12-26 14:03:48 +01:00
Steffen Schuemann
440e556f21 Merge branch 'feature-79-constexpr-bitmask-ops' 2020-12-26 14:00:42 +01:00
Steffen Schuemann
b51fe02f1a WIP version bump 2020-12-26 13:56:21 +01:00
Steffen Schuemann
ff56073075 Updated readme. 2020-12-26 13:54:57 +01:00
Steffen Schuemann
10e0da40bc refs #79, constexpr on non-assigning bitmask operations 2020-11-17 07:57:25 +01:00
Steffen Schuemann
1edf4a3339 ghc::filesysem release v1.3.8 2020-11-15 22:54:06 +01:00
Steffen Schuemann
427108c8e2 updating readme and dynamic selection examples 2020-11-15 21:12:41 +01:00
Steffen Schümann
809d680df9 refs #75, avoid messing with long namespaced path on windows 2020-11-10 08:34:21 +01:00
Steffen Schümann
b3f9635581 refs #75, fix for shadow warning in test 2020-11-09 09:09:43 +01:00
Steffen Schümann
b6dd2cd0f1 refs #75, more testing of windows path variants 2020-11-08 18:27:52 +01:00
Steffen Schümann
3fd3482559 refs #75, fix for windows path filtering on namespaces 2020-11-08 11:12:07 +01:00
Steffen Schuemann
cf7890719f refs #76, additional support for _MSVC_LANG 2020-10-25 09:02:27 +01:00
Steffen Schuemann
416c60a1d4 refs #78, added test of __MAC_OS_X_VERSION_MIN_REQUIRED 2020-10-24 12:16:50 +02:00
Steffen Schuemann
1c7204285d wip version bump 2020-10-24 12:05:11 +02:00
Steffen Schuemann
f824d0d46b refs #77, fix skip_permission_denied inconsistency 2020-10-24 12:03:58 +02:00
Steffen Schuemann
7e37433f31 Release v1.3.6 2020-10-10 09:11:06 +02:00
Florian Brenot
c82e11af33
Check symlink relative flag and use correct offsets on Windows (#74)
* Check symlink relative flag and use correct offsets

* Using the correct length this time
2020-10-10 08:58:06 +02:00
Steffen Schümann
6649653be9 Extended path prefix handling on Windows. 2020-10-09 23:57:54 +02:00
Steffen Schuemann
ff6e5e8959 updated readme 2020-10-06 21:58:55 +02:00
Steffen Schuemann
51d94c098a Merge branch 'feature-70-path-comparison' 2020-10-06 21:58:24 +02:00
Steffen Schümann
2fe72421c5 Merge branch 'feature-70-path-comparison' of https://github.com/gulrak/filesystem into feature-70-path-comparison
# Conflicts:
#	include/ghc/filesystem.hpp
2020-10-06 21:23:13 +02:00
Steffen Schümann
3cd5bc6873 refs #70, fix for non LWG2936 mode and updated readme 2020-10-06 21:17:15 +02:00
Steffen Schuemann
a22c0a94d0 refs #70, mingw compile fix 2020-10-05 22:41:46 +02:00
Steffen Schuemann
f15dea9695 refs #70, fix for missed issue and mingw errors 2020-10-05 21:59:29 +02:00
Steffen Schümann
56b5e7a174 refs #70, compare windows root names case insensitive, work on LWG 2936 option 2020-10-05 21:24:05 +02:00
Steffen Schümann
d34cf83f7e Merge remote-tracking branch 'origin/feature-73-performance-optimization' 2020-10-04 13:47:24 +02:00
Steffen Schuemann
993a6be3ce refs #72, bumped to wip version 2020-10-01 08:11:53 +02:00
Steffen Schümann
b96e1e7423 refs #73, updated readme and travis ci config 2020-10-01 08:09:28 +02:00
Steffen Schuemann
a2ce250cd8 refs #72, updated ci config 2020-09-30 09:24:45 +02:00
Steffen Schümann
c8cfcf823f refs #73, performance optimizations 2020-09-30 08:33:29 +02:00
Steffen Schuemann
56d6fc9159 refs #72, invenstigating travis xcode9.2 problems leading to timeout 2020-09-22 23:30:24 +02:00
Steffen Schuemann
f31b5baac4 refs #72, filesystem_test issues with TestAllocator 2020-09-22 00:31:24 +02:00
Steffen Schuemann
a9302df045 refs #72, ci tesing for centos 2020-09-22 00:09:36 +02:00
Steffen Schuemann
d8abf146a4 Release ghc::filesystem v1.3.4 2020-08-30 09:59:53 +02:00
Steffen Schuemann
80543b681b refs #66, removed shared_ptr guards in copy_file 2020-08-30 09:47:27 +02:00
Steffen Schuemann
fd9b1c5300 Updated readme. 2020-08-30 09:20:56 +02:00
Steffen Schuemann
cdfb593d40 Merge branch 'feature-68-experimental-emscripten-support' 2020-08-30 09:19:14 +02:00
Steffen Schuemann
f6e886f999 refs #68, updated readme, fix for failing CI on VS2019. 2020-08-29 20:34:59 +02:00
Steffen Schuemann
a47a874bee refs #68, disabled fs::space test for error case as web environment returns space for the virtual fs even for unexisting paths 2020-08-22 18:16:01 +02:00
Steffen Schuemann
3131e9735d Merge branch 'master' into feature-68-experimental-emscripten-support 2020-08-21 08:22:48 +02:00
Steffen Schuemann
9e69dd4a82 Updated readme and .gitignore 2020-08-21 08:21:43 +02:00
gulrak
46db4d8961
Merge pull request #69 from zero9178/master
Allow wchar_t constructors of iostreams on Windows when using libc++
2020-08-21 07:54:08 +02:00
zero9178
0e40179aeb Changed preprocessors checks for wchar_t constructs of iostreams from __GNUC__ to __GLIBCXX__ as libc++ provides these on Windows as well 2020-08-21 03:01:50 +02:00
Steffen Schuemann
1d41167941 refs #68, experimental support for emscripten 2020-08-20 22:26:56 +02:00
Steffen Schuemann
2ea00170e1 refs #68, better permission error handling for directory_iteratior with skip_permissions_denied 2020-08-20 21:58:34 +02:00
Steffen Schuemann
3f1c185ab4 fixes #63, Squashed commit of the following:
commit fdcb3ce89ba676d3e06b30c18c04e926a775366c
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Thu Apr 9 12:59:13 2020 +0200

    refs #63, fix typo

commit a5cadd2e5060da75315f79971dae56a0e91a8023
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Thu Apr 9 11:45:36 2020 +0200

    refs #63, work on issues with wchar and clang in windows.
2020-04-10 11:26:04 +02:00
Steffen Schuemann
9a047b9f8d Updated readme, added error handling for conflicting options. 2020-04-08 10:44:54 +02:00
gulrak
6b30995e41
Merge pull request #62 from okhowang/android
Fix android compatibility
2020-04-07 19:49:25 +02:00
gulrak
2ad75e1ff0
Merge pull request #61 from okhowang/no-exception
fixes #60, refs #43, support for usage in projects with exceptions disabled
2020-04-07 19:48:30 +02:00
Steffen Schuemann
4bf0160a15 Bump to wip version. 2020-04-07 18:27:49 +02:00
okhowang(王沛文)
a0f28a93bc Fix android compatibility 2020-04-07 22:55:13 +08:00
okhowang(王沛文)
ee9b432e3f Fixed MinGW no-exception logic 2020-04-07 19:09:54 +08:00
okhowang(王沛文)
498dd371fa merge all ifdef 2020-04-07 15:40:27 +08:00
okhowang(王沛文)
4fe99da720 Fix VS2015 compatibility 2020-04-07 14:07:47 +08:00
okhowang(王沛文)
bab6409d4e Fix MSVC compatibility 2020-04-07 12:20:14 +08:00
okhowang(王沛文)
a0ef036074 use marcro protect all code with exception 2020-04-07 11:40:42 +08:00
okhowang(王沛文)
2671c2f83b use macro protect all throw function directly 2020-04-07 10:30:36 +08:00
25 changed files with 9108 additions and 3186 deletions

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd build
echo "Tests run as user: $USER"
ctest -E Windows
if [ -f "test/std_filesystem_test" ]; then
test/std_filesystem_test || true

View File

@ -1,7 +1,6 @@
freebsd_instance:
image_family: freebsd-12-1
task:
freebsd_task:
freebsd_instance:
image_family: freebsd-14-0
install_script: |
pkg install -y cmake
pw groupadd testgrp
@ -11,3 +10,25 @@ task:
sudo -u testuser .ci/unix-build.sh
test_script: |
sudo -u testuser .ci/unix-test.sh
rockylinux8_task:
container:
image: docker.io/rockylinux:8
install_script: |
dnf group install -y "Development Tools"
dnf install cmake -y
build_script: |
.ci/unix-build.sh
test_script: |
.ci/unix-test.sh
rockylinux9_task:
container:
image: docker.io/rockylinux:9
install_script: |
dnf group install -y "Development Tools"
dnf install cmake -y
build_script: |
.ci/unix-build.sh
test_script: |
.ci/unix-test.sh

3
.clang-tidy Normal file
View File

@ -0,0 +1,3 @@
---
Checks: -modernize-use-nodiscard
...

170
.github/workflows/build_cmake.yml vendored Normal file
View File

@ -0,0 +1,170 @@
name: CMake Build Matrix
on: [ push, pull_request ]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "Ubuntu 22.04 GCC 11"
os: ubuntu-22.04
build_type: Release
packages: ninja-build
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: gcc
cxx: g++
- name: "Ubuntu 22.04 Clang 13.0"
os: ubuntu-22.04
build_type: Release
packages: ninja-build libc++-13-dev libc++abi-13-dev
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: clang-13
cxx: clang++-13
- name: "Ubuntu 22.04 Clang 15.0"
os: ubuntu-22.04
build_type: Release
packages: ninja-build libc++-15-dev libc++abi-15-dev
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: clang-15
cxx: clang++-15
- name: "Ubuntu 22.04 GCC 11 coverage"
os: ubuntu-22.04
build_type: Debug
packages: ninja-build lcov
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: gcc
cxx: g++
- name: "Ubuntu 20.04 GCC 9.3"
os: ubuntu-20.04
build_type: Release
packages: ninja-build
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: gcc
cxx: g++
- name: "Ubuntu 20.04 Clang 10.0"
os: ubuntu-20.04
build_type: Release
packages: ninja-build
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: clang-10
cxx: clang++-10
- name: "Ubuntu 20.04 Clang 11.0"
os: ubuntu-20.04
build_type: Release
packages: ninja-build clang-11 libc++-11-dev libc++abi-11-dev
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: clang-11
cxx: clang++-11
- name: "Ubuntu 20.04 GCC 9.3 coverage"
os: ubuntu-20.04
build_type: Debug
packages: ninja-build lcov
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: gcc
cxx: g++
- name: "Windows MSVC 2019"
os: windows-2019
build_type: Release
packages: ninja
generator: "Visual Studio 16 2019"
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: cl
cxx: cl
- name: "macOS 13 AppleClang"
os: macos-13
build_type: Release
packages: ninja
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: clang
cxx: clang++
steps:
- uses: actions/checkout@v2
- name: print environment
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Install dependencies on Ubuntu
if: startsWith(matrix.config.os, 'ubuntu')
shell: bash
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install ${{ matrix.config.packages }}
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ${{ matrix.config.packages }}
- name: Install dependencies on macOS
if: startsWith(matrix.config.os, 'macos')
run: |
brew install ${{ matrix.config.packages }}
- name: Configure project
shell: bash
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
ninja --version
cmake --version
mkdir build
mkdir install
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=Debug -DGHC_COVERAGE=ON -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install
else
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install
fi
- name: Build project
shell: bash
run: |
cmake --build build --config ${{ matrix.config.build_type }}
- name: Run tests
run: |
cd build && ctest -C ${{ matrix.config.build_type }}
- name: Collect coverage info
if: startsWith(matrix.config.build_type, 'Debug')
run: |
cd build
lcov --compat-libtool --directory . --capture --output-file coverage_output.info
lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info
# sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info
- name: Upload coverage info
if: startsWith(matrix.config.build_type, 'Debug')
env:
COVERALLS_DEBUG: true
NODE_COVERALLS_DEBUG: 1
uses: coverallsapp/github-action@master
with:
path-to-lcov: ${{ github.workspace }}/build/coverage.info
github-token: ${{ secrets.GITHUB_TOKEN }}

3
.gitignore vendored
View File

@ -1,4 +1,7 @@
/*build*/
.vs/
.vscode/
.idea/
*.swp
*~
.DS_Store

View File

@ -1,104 +0,0 @@
language: cpp
dist: xenial # default distribution
os: linux # default os
sudo: false
matrix:
fast_finish: true
include:
- env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["g++-5"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["g++-6"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["g++-7"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && GENERATOR='Unix Makefiles' && CONFIG=Debug && GHC_COVERAGE=1"
addons: { apt: { packages: ["g++-7", "lcov"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["g++-8"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-9 && CXX=g++-9 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["g++-9"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["clang-5.0"] } }
- env: MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["clang-6.0"] } }
- env: MATRIX_EVAL="CC=clang-7 && CXX=clang++-7 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["clang-7", "libc++-7-dev", "libc++abi-7-dev"], sources: ["llvm-toolchain-xenial-7"] } }
- env: MATRIX_EVAL="CC=clang-8 && CXX=clang++-8 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["clang-8", "libc++-8-dev", "libc++abi-8-dev"], sources: ["llvm-toolchain-xenial-8"] } }
- env: MATRIX_EVAL="CC=clang-9 && CXX=clang++-9 && GENERATOR='Unix Makefiles' && CONFIG=Release"
addons: { apt: { packages: ["clang-9", "libc++-9-dev", "libc++abi-9-dev"], sources: [{sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main', key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'}] } }
- os: osx
env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode && CONFIG=Release"
osx_image: xcode9.2
- os: osx
env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode && CONFIG=Release"
osx_image: xcode10.1
- os: osx
env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode && CONFIG=Release"
osx_image: xcode11.3
install:
- eval "${MATRIX_EVAL}"
- |
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
brew update
fi
- |
if [ "${GHC_COVERAGE}" = "1" ]; then
gem install coveralls-lcov
fi
- $CC --version
- $CXX --version
- cmake --version
before_script:
- eval "${MATRIX_EVAL}"
- mkdir build
- cd build
- export VERBOSE=1
- |
if [ "${CONFIG}" = "Debug" ]; then
cmake -G"${GENERATOR}" -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} -DCMAKE_BUILD_TYPE=${CONFIG} -DGHC_COVERAGE=ON ..
else
cmake -G"${GENERATOR}" -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} -DCMAKE_BUILD_TYPE=${CONFIG} ..
fi
script:
- export VERBOSE=1
- cmake --build . --config ${CONFIG} --target filesystem_test
- |
if [ "${GHC_COVERAGE}" = "1" ]; then
cmake --build . --config ${CONFIG} --target filesystem_test
test/filesystem_test
else
cmake --build . --config ${CONFIG}
ctest -C ${CONFIG} -E Windows
if [ -f "test/std_filesystem_test" ]; then
test/std_filesystem_test || true
fi
fi
after_success:
- |
if [ "${GHC_COVERAGE}" = "1" ]; then
lcov --compat-libtool --directory . --capture --output-file coverage_output.info
lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info
sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info
coveralls-lcov coverage.info
fi

View File

@ -1,36 +1,55 @@
cmake_minimum_required(VERSION 3.7.2)
project(ghcfilesystem)
project(
ghcfilesystem,
VERSION 1.5.15
)
include(CMakeDependentOption)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
if(POLICY CMP0110)
cmake_policy(SET CMP0110 NEW)
endif()
cmake_dependent_option(GHC_FILESYSTEM_BUILD_TESTING
"Enable tests" ON
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
cmake_dependent_option(GHC_FILESYSTEM_BUILD_EXAMPLES
"Build examples" ON
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
cmake_dependent_option(GHC_FILESYSTEM_WITH_INSTALL
"With install target" ON
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
option(GHC_FILESYSTEM_BUILD_TESTING "Enable tests" ON)
option(GHC_FILESYSTEM_BUILD_EXAMPLES "Build examples" ON)
option(GHC_FILESYSTEM_WITH_INSTALL "With install target" ON)
else()
option(GHC_FILESYSTEM_BUILD_EXAMPLES "Build examples" OFF)
option(GHC_FILESYSTEM_BUILD_TESTING "Enable tests" OFF)
option(GHC_FILESYSTEM_WITH_INSTALL "With install target" OFF)
endif()
option(GHC_FILESYSTEM_BUILD_STD_TESTING "Enable STD tests" ${GHC_FILESYSTEM_BUILD_TESTING})
if(NOT DEFINED GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
set(GHC_FILESYSTEM_TEST_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES})
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CYGWIN)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
endif()
if(CMAKE_CXX_STANDARD LESS 11)
message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, ghc::filesystem only works with C++11 and above.")
endif()
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILE_FEATURES: ${CMAKE_CXX_COMPILE_FEATURES}")
endif()
add_library(ghc_filesystem INTERFACE)
add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem)
target_include_directories(ghc_filesystem INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_options(ghc_filesystem INTERFACE "$<$<C_COMPILER_ID:MSVC>:/utf-8>")
target_compile_options(ghc_filesystem INTERFACE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
get_directory_property(hasParent PARENT_DIRECTORY)
if(NOT hasParent)
if(GHC_FILESYSTEM_BUILD_TESTING OR GHC_FILESYSTEM_BUILD_EXAMPLES)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(GhcHelper)
@ -48,9 +67,24 @@ endif()
if(GHC_FILESYSTEM_WITH_INSTALL)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS ghc_filesystem EXPORT ghcFilesystemConfig)
install(EXPORT ghcFilesystemConfig NAMESPACE ghcFilesystem:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem)
install(TARGETS ghc_filesystem EXPORT ghc_filesystem-targets)
install(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem")
export(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ghc_filesystem-targets.cmake")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in"
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem"
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion
)
install(
FILES
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem"
)
endif()

833
README.md

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
macro(AddExecutableWithStdFS targetName)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
if(APPLE)
include_directories(/usr/local/opt/llvm/include)
link_directories(/usr/local/opt/llvm/lib)
@ -12,7 +11,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION
target_link_libraries(${targetName} -lc++fs)
else()
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
target_link_libraries(${targetName} -stdlib=libc++ -lc++fs)
target_link_libraries(${targetName} -stdlib=libc++ -lc++fs $<$<PLATFORM_ID:Linux>:rt>)
endif()
else()
if(NOT APPLE)
@ -20,6 +19,12 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION
target_link_libraries(${targetName} -stdlib=libc++)
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test xnet)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(filesystem_test network)
endif()
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
endif()
@ -29,6 +34,13 @@ if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 O
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
target_link_libraries(${targetName} -lstdc++fs)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(${targetName} xnet)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(${targetName} network)
endif()
target_compile_options(${targetName} PRIVATE $<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
endif()
@ -41,3 +53,29 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQ
endif()
endmacro()
macro(AddTestExecutableWithStdCpp cppStd)
add_executable(filesystem_test_cpp${cppStd} ${ARGN})
set_property(TARGET filesystem_test_cpp${cppStd} PROPERTY CXX_STANDARD ${cppStd})
target_link_libraries(filesystem_test_cpp${cppStd} ghc_filesystem)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test_cpp${cppStd} xnet)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(filesystem_test_cpp${cppStd} network)
endif()
target_compile_options(filesystem_test_cpp${cppStd} PRIVATE
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
if(EMSCRIPTEN)
set_target_properties(filesystem_test_cpp${cppStd} PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
endif()
ParseAndAddCatchTests(filesystem_test_cpp${cppStd})
endmacro()

View File

@ -1,5 +1,6 @@
@PACKAGE_INIT@
set_and_check(ghcfilesystem_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
# import targets
include("${CMAKE_CURRENT_LIST_DIR}/ghc_filesystem-targets.cmake")
check_required_components(ghcfilesystem)
check_required_components(ghcfilesystem)

View File

@ -10,3 +10,8 @@ add_executable(fs_du du.cpp)
target_link_libraries(fs_du ghc_filesystem)
AddExecutableWithStdFS(std_fs_du du.cpp)
if(EXISTS "${PROJECT_SOURCE_DIR}/examples/benchmark.cpp")
add_executable(fs_benchmark benchmark.cpp)
set_property(TARGET fs_benchmark PROPERTY CXX_STANDARD 17)
target_link_libraries(fs_benchmark ghc_filesystem)
endif()

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
// fs_fwd.hpp - The forwarding header for the header/implementation seperated usage of
// fs_fwd.hpp - The forwarding header for the header/implementation separated usage of
// ghc::filesystem.
// This file can be include at any place, where ghc::filesystem api is needed while
// not bleeding implementation details (e.g. system includes) into the global namespace,
@ -34,5 +34,5 @@
#ifndef GHC_FILESYSTEM_FWD_H
#define GHC_FILESYSTEM_FWD_H
#define GHC_FILESYSTEM_FWD
#include <ghc/filesystem.hpp>
#include "filesystem.hpp"
#endif // GHC_FILESYSTEM_FWD_H

View File

@ -25,11 +25,11 @@
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
// fs_impl.hpp - The implementation header for the header/implementation seperated usage of
// fs_impl.hpp - The implementation header for the header/implementation separated usage of
// ghc::filesystem.
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
// The cpp has to include this before including fs_fwd.hpp directly or via a different
// header to work.
//---------------------------------------------------------------------------------------
#define GHC_FILESYSTEM_IMPLEMENTATION
#include <ghc/filesystem.hpp>
#include "filesystem.hpp"

View File

@ -30,27 +30,48 @@
// namespace fs.
//---------------------------------------------------------------------------------------
#ifndef GHC_FILESYSTEM_STD_H
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#include <filesystem>
namespace fs {
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
}
#endif
#endif
#ifndef GHC_USE_STD_FS
#define GHC_WIN_WSTRING_STRING_TYPE
#include <ghc/filesystem.hpp>
namespace fs {
using namespace ghc::filesystem;
using ifstream = ghc::filesystem::ifstream;
using ofstream = ghc::filesystem::ofstream;
using fstream = ghc::filesystem::fstream;
}
#endif
#endif // GHC_FILESYSTEM_STD_H
#define GHC_FILESYSTEM_STD_H
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
#define GHC_USE_STD_FS
// Old Apple OSs don't support std::filesystem, though the header is available at compile
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
// and watchOS 6.0.
#ifdef __APPLE__
#include <Availability.h>
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
// released after std::filesystem, where std::filesystem is always available.
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
#undef GHC_USE_STD_FS
#endif
#endif
#endif
#endif
#ifdef GHC_USE_STD_FS
#include <filesystem>
namespace fs {
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
}
#else
#include "filesystem.hpp"
namespace fs {
using namespace ghc::filesystem;
using ifstream = ghc::filesystem::ifstream;
using ofstream = ghc::filesystem::ofstream;
using fstream = ghc::filesystem::fstream;
}
#endif
#endif // GHC_FILESYSTEM_STD_H

View File

@ -25,7 +25,7 @@
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
// fs_std_fwd.hpp - The forwarding header for the header/implementation seperated usage of
// fs_std_fwd.hpp - The forwarding header for the header/implementation separated usage of
// ghc::filesystem that uses std::filesystem if it detects it.
// This file can be include at any place, where fs::filesystem api is needed while
// not bleeding implementation details (e.g. system includes) into the global namespace,
@ -33,28 +33,47 @@
//---------------------------------------------------------------------------------------
#ifndef GHC_FILESYSTEM_STD_FWD_H
#define GHC_FILESYSTEM_STD_FWD_H
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#include <filesystem>
namespace fs {
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
}
#endif
#endif
#ifndef GHC_USE_STD_FS
#define GHC_WIN_WSTRING_STRING_TYPE
#define GHC_FILESYSTEM_FWD
#include <ghc/filesystem.hpp>
namespace fs {
using namespace ghc::filesystem;
using ifstream = ghc::filesystem::ifstream;
using ofstream = ghc::filesystem::ofstream;
using fstream = ghc::filesystem::fstream;
}
#endif
#endif // GHC_FILESYSTEM_STD_FWD_H
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
#define GHC_USE_STD_FS
// Old Apple OSs don't support std::filesystem, though the header is available at compile
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
// and watchOS 6.0.
#ifdef __APPLE__
#include <Availability.h>
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
// released after std::filesystem, where std::filesystem is always available.
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
#undef GHC_USE_STD_FS
#endif
#endif
#endif
#endif
#ifdef GHC_USE_STD_FS
#include <filesystem>
namespace fs {
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
}
#else
#include "fs_fwd.hpp"
namespace fs {
using namespace ghc::filesystem;
using ifstream = ghc::filesystem::ifstream;
using ofstream = ghc::filesystem::ofstream;
using fstream = ghc::filesystem::fstream;
}
#endif
#endif // GHC_FILESYSTEM_STD_FWD_H

View File

@ -25,19 +25,36 @@
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
// fs_std_impl.hpp - The implementation header for the header/implementation seperated usage of
// fs_std_impl.hpp - The implementation header for the header/implementation separated usage of
// ghc::filesystem that does nothing if std::filesystem is detected.
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
// The cpp has to include this before including fs_std_fwd.hpp directly or via a different
// header to work.
//---------------------------------------------------------------------------------------
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#endif
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
#define GHC_USE_STD_FS
// Old Apple OSs don't support std::filesystem, though the header is available at compile
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
// and watchOS 6.0.
#ifdef __APPLE__
#include <Availability.h>
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
// released after std::filesystem, where std::filesystem is always available.
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
#undef GHC_USE_STD_FS
#endif
#endif
#endif
#endif
#ifndef GHC_USE_STD_FS
#define GHC_WIN_WSTRING_STRING_TYPE
#define GHC_FILESYSTEM_IMPLEMENTATION
#include <ghc/filesystem.hpp>
#include "fs_impl.hpp"
#endif

View File

@ -3,6 +3,20 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
set(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON)
include(ParseAndAddCatchTests)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND UNIX AND NOT APPLE AND NOT BSD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "-lc++abi")
endif()
function(SetTestCompileOptions target_name)
target_compile_options(${target_name} PRIVATE
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
endfunction()
if(GHC_COVERAGE)
message("Generating test runner for coverage run...")
set(CMAKE_EXE_LINKER_FLAGS "${CMCMAKE_EXE_LINKER_FLAGS} --coverage")
@ -13,32 +27,55 @@ if(GHC_COVERAGE)
target_compile_options(filesystem_test PUBLIC --coverage)
endif()
target_link_libraries(filesystem_test PUBLIC ghc_filesystem --coverage)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test PUBLIC xnet)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(filesystem_test PUBLIC network)
endif()
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
endif()
if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp)
endif()
else()
message("Generating test runner for normal test...")
add_executable(filesystem_test filesystem_test.cpp catch.hpp)
target_link_libraries(filesystem_test ghc_filesystem)
target_compile_options(filesystem_test PRIVATE
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(filesystem_test xnet)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(filesystem_test network)
endif()
SetTestCompileOptions(filesystem_test)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS)
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
endif()
if(EMSCRIPTEN)
set_target_properties(filesystem_test PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
endif()
ParseAndAddCatchTests(filesystem_test)
AddExecutableWithStdFS(std_filesystem_test filesystem_test.cpp catch.hpp)
if(GHC_FILESYSTEM_BUILD_STD_TESTING)
AddExecutableWithStdFS(std_filesystem_test filesystem_test.cpp catch.hpp)
endif()
if(WIN32)
add_executable(filesystem_test_wchar filesystem_test.cpp catch.hpp)
target_link_libraries(filesystem_test_wchar ghc_filesystem)
target_compile_options(filesystem_test_wchar PRIVATE
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Werror>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
add_executable(filesystem_test_char filesystem_test.cpp catch.hpp)
target_link_libraries(filesystem_test_char ghc_filesystem)
SetTestCompileOptions(filesystem_test_char)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test_wchar PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_WSTRING_STRING_TYPE)
target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
else()
target_compile_definitions(filesystem_test_wchar PRIVATE GHC_WIN_WSTRING_STRING_TYPE)
target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
endif()
ParseAndAddCatchTests(filesystem_test_wchar)
ParseAndAddCatchTests(filesystem_test_char)
endif()
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
endif()
if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp)
endif()
endif()
@ -48,7 +85,21 @@ add_test(multifile_test multifile_test)
add_executable(fwd_impl_test fwd_test.cpp impl_test.cpp)
target_link_libraries(fwd_impl_test ghc_filesystem)
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
target_link_libraries(fwd_impl_test xnet)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(fwd_impl_test network)
endif()
SetTestCompileOptions(fwd_impl_test)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS)
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
endif()
add_test(fwd_impl_test fwd_impl_test)
add_executable(exception exception.cpp)
if(NOT MSVC)
target_compile_options(exception PRIVATE -fno-exceptions)
endif()
target_include_directories(exception PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
SetTestCompileOptions(exception)

File diff suppressed because it is too large Load Diff

View File

@ -144,7 +144,7 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
if("${TestType}" STREQUAL "SCENARIO")
set(Name "Scenario: ${Name}")
endif()
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture )
set(CTestName "${TestFixture}:${Name}")
else()
set(CTestName "${Name}")
@ -189,24 +189,29 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
# Escape commas in the test spec
string(REPLACE "," "\\," Name ${Name})
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were neccessary,
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
if(NOT ${CMAKE_VERSION} VERSION_EQUAL "3.18")
set(CTestName "\"${CTestName}\"")
endif()
# Add the test and set its properties
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
else()
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
LABELS "${Labels}")
endif()
set_property(
TARGET ${TestTarget}
APPEND
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
set_property(
SOURCE ${SourceFile}
APPEND
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
endif()

5
test/exception.cpp Normal file
View File

@ -0,0 +1,5 @@
#include <ghc/filesystem.hpp>
int main() {
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,6 @@
// where exactly one cpp includes fs_impl.hpp and all others use
// fs_fwd.hpp (to test this with maximum functionality, the unit tests
// are included here, signaling they should only include the fs_fwd.hpp)
#define NOMINMAX
#include <ghc/fs_impl.hpp>
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

View File

@ -27,7 +27,7 @@
#include <ghc/filesystem.hpp>
namespace fs = ghc::filesystem;
// This test and the one in multi2.cpp doesn't actualy test relevant functionality,
// This test and the one in multi2.cpp doesn't actually test relevant functionality,
// it is just used to check that it is possible to include filesystem.h in multiple
// source files.
TEST_CASE("Multifile-test 1", "[multi]")