Compare commits

...

445 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
Steffen Schuemann
3605e86915 Updated readme and v1.3.2 version bump. 2020-03-31 00:01:31 +02:00
Steffen Schuemann
683ed6838e Merge branch 'master' of github.com:gulrak/filesystem 2020-03-23 19:17:58 +01:00
Steffen Schuemann
56827ea52d refs #58, compile error on MinGW 2020-03-23 19:17:19 +01:00
gulrak
82d5d83bf8
Merge pull request #57 from ligfx/fix_lexically_relative_to_path_with_trailing_slash
refs #56, lexically_relative: ignore trailing slash on base
2020-03-23 12:17:24 +01:00
Michael M
e3201da883 lexically_relative: ignore trailing slash on base
Previously,

    fs::path("a/b").lexically_relative("a/")

would incorrectly return "../b". Now it returns "b".
2020-03-22 16:26:59 -07:00
Steffen Schuemann
26077f272e refs #54, directory_entry methods now reset error_code, when returning cached result 2020-03-06 09:19:46 +01:00
Steffen Schuemann
d93ccea812 refs #55, fs::create_directories reported true if it didn't need to create anything. 2020-03-05 06:48:54 +01:00
Steffen Schuemann
70a0085a47 Fix issues introduced with PR 53. 2020-03-04 08:41:15 +01:00
Steffen Schuemann
1a70520422 Merge branch 'master' of github.com:gulrak/filesystem 2020-03-04 08:31:49 +01:00
Steffen Schuemann
083a981464 Updated readme. 2020-03-04 08:31:41 +01:00
gulrak
bd30737e81
Merge pull request #53 from jnhyatt/leading-whitespace
Bugfix - Leading Whitespace On Stream In
2020-03-04 08:26:26 +01:00
jnhyatt
a778e6d76e Remove leading whitespace when first character is whitespace 2020-03-04 04:54:15 -07:00
gulrak
05bcd2ccc4
Merge pull request #52 from nightlark/add-arm-ci-build
Add ARM builds on Drone CI
2020-03-04 07:50:35 +01:00
gulrak
65957f43f0
Merge pull request #51 from nightlark/add-freebsd-ci-build
Add FreeBSD build on Cirrus CI
2020-03-04 07:43:45 +01:00
gulrak
1d85ec3572
Merge pull request #50 from nightlark/fix-conversion-warning-32bit-target
Static cast to fix conversion error on 32-bit processors
2020-03-04 07:38:48 +01:00
Steffen Schuemann
21b1fb9d1d Next wip version. 2020-03-04 07:38:00 +01:00
Ryan Mast
37fafe5f1a Add ARM builds on Drone CI 2020-02-29 15:20:00 -08:00
Ryan Mast
6c806a7145 Add FreeBSD build on Cirrus CI 2020-02-29 15:11:19 -08:00
Ryan Mast
94738c9065 Static cast to fix conversion error on 32-bit processors 2020-02-29 14:10:13 -08:00
gulrak
e63a58c5ba
Merge pull request #49 from despair86/master
define targets for generic BSD and oracle machines
2020-02-15 09:28:24 +01:00
Rick V
c193676fe9 define targets for generic BSD and oracle machines 2020-02-13 18:51:29 -06:00
gulrak
05ecaa498c
Merge pull request #48 from InnerPortal/master
Fix typo
2020-02-11 23:23:52 +01:00
Sean Portal
84c905016f Fix typo
"C++147" ==> "C++14"
2020-02-11 17:39:50 +00:00
Steffen Schuemann
c428aba39d Merge branch 'master' of github.com:gulrak/filesystem 2020-02-08 18:29:56 +01:00
Steffen Schuemann
0989fd1ca1 Version Bump to v1.3.0, switch to MIT license 2020-02-08 18:22:37 +01:00
gulrak
8157b4eb9d
Merge pull request #46 from tohammer/fix-unused-parameter-android
Suppress unused parameter warning on android
2020-01-25 09:03:24 +01:00
Tobias Hammer
7b9e8a5894 Suppress unused parameter warning on android 2020-01-23 09:27:12 +01:00
Steffen Schuemann
10937ca294 refs #44, using Xcode 11.3 in CI 2019-12-21 14:29:59 +01:00
Steffen Schuemann
c96bc30a3f refs #44, warnings on Xcode 11.3 2019-12-21 12:38:57 +01:00
Steffen Schuemann
f5bfb98aea minor refactorings and work on ci integration 2019-12-08 13:49:15 +01:00
gulrak
e7169c4943 stop linking std::filesystem tests against libc++fs on clang 9 2019-12-07 15:01:20 +01:00
Steffen Schuemann
8facfa0044 Updated readme and version bump to v1.2.10 2019-11-24 16:33:29 +01:00
Steffen Schuemann
a47e15d434 work on CI configuration 2019-11-24 15:34:41 +01:00
Steffen Schuemann
9a873d3705 work on CI configuration 2019-11-24 14:10:47 +01:00
Steffen Schuemann
c5f16d6ce7 work on CI configuration 2019-11-24 12:09:57 +01:00
Steffen Schuemann
f29dd973c2 work on CI configuration. 2019-11-24 11:54:54 +01:00
Steffen Schuemann
07b7d46e8b refs #38, added check for older GCCs 2019-11-24 00:30:12 +01:00
Steffen Schuemann
2c3242a38e refs #38, switched to pragma based fix, as it seams the most widely accepted way. 2019-11-23 23:53:36 +01:00
Steffen Schümann
c37d756a7f refs #41, fs::rename now overwrites existing files on windows, extended tests 2019-11-22 18:48:10 +01:00
Steffen Schümann
5a933d5c52 refs #39, remove DWORD dependency in forwarding mode and change test to trigger an error if there is a dependency to windows.h 2019-11-22 18:46:21 +01:00
Steffen Schümann
c97ac97b30 Merge remote-tracking branch 'origin/feature-38-getprocaddress-warnings' 2019-11-22 11:00:53 +01:00
gulrak
4726dd5713
Merge pull request #40 from Zer0xFF/patch-1
typo fix
2019-11-21 12:00:58 +01:00
Zer0xFF
43db588e61
typo 2019-11-19 23:49:47 +00:00
gulrak
73da6e1a95 refs #38, work on warning about GetProcAddress cast on MSYS2 GCC9.2 2019-11-17 21:20:19 +01:00
gulrak
8ea72cfb73 Updated readme. 2019-11-15 14:28:23 +01:00
gulrak
d3d4597f42 Updated readme. 2019-11-15 14:26:14 +01:00
gulrak
461a6c0154 Updated readme and version bump to v1.2.8 2019-11-15 09:05:17 +01:00
gulrak
059b2fab78 Small test cleanup to help ctest. 2019-11-15 08:29:05 +01:00
gulrak
01d1f685fc
Merge pull request #37 from cybik/patch-1
Typo
2019-11-10 22:55:00 +01:00
Renaud Lepage
3a6c550dc0
Typo 2019-11-09 16:40:09 -08:00
Steffen Schuemann
c1a2fb5d17 refs #36, fix for warnings on xcode 11.2 due to unhelpful use of references 2019-11-07 09:10:09 +01:00
Steffen Schuemann
7301cd1105 refs #35, new option GHC_FILESYSTEM_WITH_INSTALL defaulting to ON only if not used as subdirectory. 2019-11-07 08:56:35 +01:00
Steffen Schuemann
9ac9c9ca49 Adding Xcode 11.2 to travis 2019-11-07 06:21:12 +01:00
gulrak
741eaca3fd
Merge pull request #34 from jeanguyomarch/toctou-race
fix: TOCTOU race when creating directories
2019-11-06 19:54:09 +01:00
Jean Guyomarc'h
b5df8c5942 fix: TOCTOU race when creating directories
When create_directories() is called to create a chain of directories,
path components are created one by one. For each path component, ghc
checks if the directory exists. If not it attempts to create it. In
case of failure to create this directory, the function fails.

This behavior exhibits a TOCTOU (Time Of Check/Time Of Use) race when
different threads of execution (e.g. different processes) attempt to
create the same paths (or paths that contain a common hierarchy).
The following sequence of events between threads T1 and T2 illustrates
the issue:

  T1: checks path P exists: no. Will attempt to create P...
  T2: checks path P exists: no. Will attempt to create P...
  T1: creates P, no error
  T2: fails to create P: raises an error

It is not desirable for create_directories() to fail in this case. This
commit mirrors the GNU libstdc++ implementation of the c++ filesystem
library: if the creation of a directory fails, we will inspect the path
that should have been created as a directory. If it is indeed a
directory (another thread of execution created it for us), the error is
now reset and the function continues to iterate to the next path
component.
2019-11-06 15:09:52 +01:00
Steffen Schuemann
9db85faf14 refs #33, fix for lexically_normal 2019-10-23 23:08:15 +02:00
Steffen Schuemann
cf5188899b refs #33, added test for trailing preferred seperator on last '..' for path::lexically_normal 2019-10-23 22:21:10 +02:00
Steffen Schuemann
8302328ef9 Merge branch 'master' of github.com:gulrak/filesystem 2019-10-03 10:02:05 +02:00
Steffen Schuemann
24d6c7e7de Updated readme. 2019-10-03 10:01:45 +02:00
gulrak
21fc37b0e2
Merge pull request #31 from jwnimmer-tri/deprecated-static-constexpr-storage
Fix storage deprecation warning when in C++17 mode
2019-09-30 20:37:22 +02:00
gulrak
9b9528cfad
Merge pull request #32 from jwnimmer-tri/warning-old-style-cast
Fix old-style-cast warnings
2019-09-30 20:35:29 +02:00
Jeremy Nimmer
8f4ea166a2 Fix old-style-cast warnings
Fixes "error: use of old-style cast [-Werror=old-style-cast]" when compiling
with GCC 7.4.
2019-09-30 10:05:01 -04:00
Jeremy Nimmer
ee8dd08c6c Fix storage deprecation warning when in C++17 mode
Fixes "error: redundant redeclaration of 'constexpr' static data member
'ghc::filesystem::path_helper_base<char_type>::preferred_separator'
[-Werror=deprecated]" when compiling with GCC 7.4 in -std=c++17 mode.
2019-09-30 09:45:59 -04:00
gulrak
65b54093ea
Merge pull request #24 from JonasVautherin/export-target
export as target
2019-09-29 19:20:06 +02:00
gulrak
49df1eaefb
Merge pull request #30 from asmaloney/options-submodule
CMake: Do not include test and example options if including as submodule
2019-09-27 19:43:36 +02:00
Steffen Schuemann
9a3c37fedf Merge branch 'master' of github.com:gulrak/filesystem 2019-09-27 19:42:50 +02:00
Steffen Schuemann
9de8ce5b38 wip version bump 2019-09-27 19:42:12 +02:00
Andy Maloney
ccdd8ec40e Do not include test and example options if including as submodule
Also rename these options so it's clear they are part of GHC Filesystem
2019-09-27 13:03:07 -04:00
gulrak
aae1331300
Update README.md 2019-09-21 18:30:36 +02:00
Steffen Schuemann
15a82e9098 Version bump to v1.2.6 2019-09-21 17:06:54 +02:00
Steffen Schuemann
6a9196fc39 Updated README.md 2019-09-21 16:56:42 +02:00
Steffen Schuemann
fbdee68f21 refs #27, Squashed commit of the following:
commit aabbf8f3d880dcd0aeaa97f014d91d54dfa24ed4
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Sat Sep 21 16:22:25 2019 +0200

    refs #27, ghc::filesystem::path::preferred_seperator fix for VS2015

commit 03b437cefb39746127b34ce6c9d47df7209a27c7
Merge: cbe0c61 589219b
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Fri Sep 20 13:42:31 2019 +0200

    Merge branch 'master' into feature-27-mingw-preferred_separator

commit cbe0c61492f3a6817f03343bb16d73211625a9cb
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sat Aug 24 22:20:10 2019 +0200

    Test for workaround of static constexpr issue
2019-09-21 16:46:00 +02:00
Steffen Schuemann
589219bb0d refs #29, fixes for MinGW warnings 2019-09-01 09:23:39 +02:00
Steffen Schuemann
d12bdbed99 refs #29, work on stricter warning set 2019-09-01 08:27:23 +02:00
Jonas Vautherin
daebcb3c96 export as target 2019-08-16 09:43:22 +02:00
Steffen Schuemann
135015f20b Fix for wchar_t issue introduced with last commit. 2019-08-15 15:19:48 +02:00
Steffen Schuemann
1da2158ed1 Version bump to wip version, updated readme, some cleanup on defines. 2019-08-15 14:56:11 +02:00
Steffen Schuemann
79fb211570 Added std::string_view test checks when __cpp_lib_string_view is defined 2019-08-15 14:47:13 +02:00
gulrak
4b10425417
Merge pull request #25 from karjonas/string_view
Fix missing string_view path specialization for C++17 support
2019-08-15 14:31:55 +02:00
Jonas Karlsson
af3d35cc1d Fix missing string_view path method 2019-08-14 16:33:31 +02:00
gulrak
b6526679a3
Merge pull request #23 from JonasVautherin/add-build-options
make tests and examples optional
2019-08-13 16:17:41 +02:00
Jonas Vautherin
57f3a14d59 make tests and examples optional 2019-08-13 15:13:09 +02:00
Steffen Schuemann
e980ed0dc4 Version bump and updated readme for v1.2.4. 2019-08-11 09:53:36 +02:00
Steffen Schuemann
8906e8ce91 refs #22, copy_options now forwarded to copy_file, added test. 2019-08-09 16:37:15 +02:00
Steffen Schuemann
17bad8c51d Updated readme and wip version. 2019-08-05 12:10:00 +02:00
Steffen Schuemann
c2c74695d2 More warning fixes to support -Wextra on MingW. 2019-07-05 07:28:21 +02:00
Steffen Schuemann
3c14bd1af2 Fix for shadow issue in tests. 2019-07-04 08:54:56 +02:00
Steffen Schuemann
361af7e51d Fix against clock conversion precision issues in tests. 2019-07-04 08:35:20 +02:00
Steffen Schuemann
8dee4d7731 Fix for -Wshadow warning, and some issues when compiling tests against std::filesystem on GCC 9.1 2019-07-04 08:00:35 +02:00
Steffen Schuemann
09bd182416 Updated readme. 2019-06-25 19:27:34 +02:00
Steffen Schuemann
e046f1ad2b Fixed wrong release links in readme. 2019-06-25 00:14:01 +02:00
Steffen Schuemann
b71022f70c Updated readme. 2019-06-23 16:50:15 +02:00
Steffen Schuemann
7c8fb02574 Version bump, updated readme. 2019-06-23 16:45:43 +02:00
Steffen Schuemann
8e824cedef refs #21, dropping macro based detection and using generic aproach. 2019-06-17 20:45:14 +02:00
Steffen Schuemann
091c08663a Updated readme. 2019-06-02 13:16:11 +02:00
Steffen Schuemann
eec82f8de6 Version bump, release v1.2.0 2019-06-02 12:53:34 +02:00
Steffen Schuemann
98dad7f0a1 refs #18, unicode error raise can now be enabled with define GHC_RAISE_UNICODE_ERRORS 2019-06-02 11:52:07 +02:00
Steffen Schuemann
2969bad152 refs #17, fixed another issue on mingw when using wchar_t/wstring 2019-06-02 11:31:44 +02:00
Steffen Schuemann
2aa08c17c1 refs 17, copy & paste error broke the build 2019-06-02 11:01:01 +02:00
Steffen Schuemann
d80948287e refs #17, fix for issues with mingw 2019-06-02 10:53:16 +02:00
Steffen Schuemann
e4e6246eaa refs #17, fix for wrong use of fs::ofstream 2019-06-02 09:33:19 +02:00
Steffen Schuemann
b5e18c859d refs #17, run test variant with GHC_WIN_WSTRING_STRING_TYPE enabled on windows ci 2019-06-02 08:53:18 +02:00
Steffen Schuemann
7aa38946a9 refs #17, defaulting to value_type = wchar_t and string_type = std::wstring on Windows when using fs_std*.hpp helper header 2019-06-01 21:15:23 +02:00
Steffen Schuemann
3fcb3f51e1 optional Windows wchar_t/wstring support
Squashed commit of the following:

commit f4a85d2070bb62bdca644f81faa953ba5fb5e491
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Sun May 19 10:02:22 2019 +0200

    refs #17, refs #18, Missing use of alloc in fromUtf8 (fixed on master) and initialization order issue.

commit aa1cb7081630393659204641792bc7641f0c72aa
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Sun May 19 09:46:02 2019 +0200

    refs #18, fighting VS2015 sfinae issues

commit 15788d8eb9972965ec4562c6e672a8a460e5b655
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Sat May 18 10:35:25 2019 +0200

    refs #17, work on wchar_t/wstring support on Windows.
2019-05-31 07:08:48 +02:00
Steffen Schuemann
235a594240 Squashed commit of the following:
commit 9cc8cbf731375fbedac9e76f883664a27814bff0
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Mon May 27 09:36:09 2019 +0200

    Workaround for bug in clangs libc++ std::filesystem::path::format.

commit 72285d01f2a269247084dddb8fe8d9da66f082a1
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Mon May 27 09:17:49 2019 +0200

    Test coverage.

commit f3ab2af99fda2dad26334d2a4884faa7463f7edb
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Sun May 26 12:35:39 2019 +0200

    Fixed std builds, removed non-standard conforming swap in directory_iterator/recursive_directory_iterator.

commit 3ae76b29a0745319d2a64e34bdbcb35264ad3e99
Author: gulrak <s.schuemann@pobox.com>
Date:   Sun May 26 11:08:52 2019 +0200

    Additional tests.

commit af4bbe14e192b464d3fece68c5dbcf3bf1c4e214
Author: gulrak <s.schuemann@pobox.com>
Date:   Fri May 24 21:52:15 2019 +0200

    Added more tests.
2019-05-31 00:46:29 +02:00
Steffen Schümann
8552dc6092 Added big-obj compile options for coverage builds on mingw. 2019-05-30 21:49:59 +02:00
Steffen Schümann
96ea0dd12e Activated an aditional unit test on windows. 2019-05-24 00:29:17 +02:00
Steffen Schuemann
b970da3128 Disabled bad check that is not dependend of root name support. 2019-05-23 09:19:49 +02:00
Steffen Schuemann
962df76d10 Merge branch 'master' of github.com:gulrak/filesystem 2019-05-23 08:39:16 +02:00
Steffen Schuemann
22de93ac45 Fix for error handling issue in utf8 converter and additional tests for enhanced coverage. 2019-05-23 08:39:04 +02:00
gulrak
db09380e4b
Merge pull request #20 from actboy168/patch-2
Fix an fd leak
2019-05-23 08:37:32 +02:00
actboy168
4a749c02b8
Fix a fd leak 2019-05-23 09:46:21 +08:00
Steffen Schuemann
ca969ab341 Relative coverage path. 2019-05-21 09:06:44 +02:00
Steffen Schuemann
fa99351935 Added coverage info badge to readme. 2019-05-21 08:29:14 +02:00
Steffen Schuemann
4a9d2901ef Updated readme. 2019-05-21 08:26:32 +02:00
Steffen Schuemann
169fac8274 Cleanup coverage paths. 2019-05-21 08:23:05 +02:00
Steffen Schuemann
8b37292acb Work on better CI integration. 2019-05-21 08:07:43 +02:00
Steffen Schuemann
2a15f1833f Work on better CI integration. 2019-05-21 07:47:54 +02:00
Steffen Schuemann
4d880e1be9 Work on better CI integration. 2019-05-21 07:43:44 +02:00
Steffen Schuemann
2635c0815c Work on better CI integration. 2019-05-21 07:15:49 +02:00
Steffen Schuemann
4f2d54af74 Work on better CI integration. 2019-05-20 22:19:39 +02:00
Steffen Schuemann
b84593086f Work on better CI integration. 2019-05-20 21:57:24 +02:00
Steffen Schuemann
7d89059b17 Work on better CI integration. 2019-05-20 21:24:36 +02:00
Steffen Schuemann
c782650f33 Work on better CI integration. 2019-05-20 21:10:54 +02:00
Steffen Schuemann
d2ed3e5614 Work on better CI integration. 2019-05-19 22:10:08 +02:00
Steffen Schuemann
d4951839ca Work on better CI integration. 2019-05-19 20:20:05 +02:00
Steffen Schuemann
aae12ecf9f Work on better CI integration. 2019-05-19 18:12:38 +02:00
Steffen Schuemann
2336e02dd3 Work on better CI integration. 2019-05-19 17:27:00 +02:00
Steffen Schuemann
63cdf7f97a Work on better CI integration. 2019-05-19 17:15:19 +02:00
Steffen Schuemann
f0b75701a8 Work on better CI integration. 2019-05-19 13:04:36 +02:00
Steffen Schuemann
61fd23d9cd Work on better CI integration. 2019-05-19 12:58:16 +02:00
Steffen Schuemann
fdf5d37383 Work on better CI integration. 2019-05-19 12:41:52 +02:00
Steffen Schuemann
3dc4319e08 Work on better CI integration. 2019-05-19 12:06:04 +02:00
gulrak
1d4cf99540
Merge pull request #19 from kleuter/master
Fixed readme example checking for valid UTF8
2019-05-18 19:30:54 +02:00
Steffen Schuemann
082e606591 refs #18, revert change due to VS2015 compilation issues. 2019-05-18 18:14:51 +02:00
kleuter
dcf28643f0 Update README.md 2019-05-18 16:00:41 +02:00
Steffen Schuemann
6d173c50a9 refs #18, added missing allocator parameter to std::string case of fromUtf8 2019-05-18 10:47:49 +02:00
Steffen Schuemann
40ef125494 refs #18, missing small fix 2019-05-18 10:31:42 +02:00
Steffen Schuemann
5c72bacf2c Merge branch 'master' of github.com:gulrak/filesystem
# Conflicts:
#	include/ghc/filesystem.hpp
2019-05-18 10:22:41 +02:00
Steffen Schuemann
9d5bc604c9 refs #18, some refactoring on unicode handling and a fix for a VS2019 warning. 2019-05-18 10:19:00 +02:00
Steffen Schümann
33e3a36044 refs #16, support for VS2019, templated char size dispatching in utf8 decoder 2019-05-15 08:10:20 +02:00
Steffen Schuemann
61182d039f Added missing header for better VS2019 support. 2019-05-15 06:18:25 +02:00
Steffen Schuemann
91e02dc2c4 Work on CI support for MingW, fixing some MingW issues 2019-05-14 08:42:29 +02:00
gulrak
3117060ed9
Merge pull request #14 from fenglc/master
Added cmake install support, thanks for the PR.
2019-05-11 16:44:00 +02:00
Steffen Schümann
38b9192d3a Version bump to wip version. 2019-05-11 15:51:17 +02:00
Steffen Schümann
16a5fbb86e Small changes for MingW compiles concerning unsupported error code and clarified test in utf8 decoder. 2019-05-11 15:49:26 +02:00
Steffen Schuemann
7e975a8f7f Updated readme, more tests, some typos in comments. 2019-05-11 15:33:08 +02:00
fenglc89
71a50bb34a cmake install 2019-05-08 17:40:56 +08:00
Steffen Schuemann
9ea5a8773b Updated readme. 2019-05-07 23:06:11 +02:00
Steffen Schuemann
bdf434d4bb Merge branch 'master' of github.com:gulrak/filesystem 2019-05-07 22:38:35 +02:00
Steffen Schuemann
fe3d15f449 Version bump, bugfix release v1.1.4 2019-05-07 22:31:24 +02:00
Steffen Schuemann
163d401f99 Added missing include for the fwd/impl use case. 2019-05-07 22:25:41 +02:00
gulrak
2b2bd77020
Merge pull request #13 from fenglc/patch-1
Reduced minimum required cmake version to 3.7.2, to support e.g. Debian Stretch.
2019-05-07 22:08:47 +02:00
Steffen Schuemann
275a1b714c Clearer non inverted logic for primitive case insensitive compare, updated readme. 2019-05-07 22:02:38 +02:00
Steffen Schuemann
87ae60ed83 Added Xcode 10.2 to Travis-CI config. 2019-05-07 21:50:10 +02:00
Steffen Schuemann
bc1abfa01e Fix file_time_type handling when building against MSVC C++17 std::filesystem, additional test fixes. 2019-05-07 20:33:56 +02:00
gulrak
04b6fa278b wip version bump 2019-05-07 19:52:38 +02:00
gulrak
cc476ac1fd refs #13, rework of POSIX directory_iterator handling, performance optimization 2019-05-07 19:49:01 +02:00
fenglc
de1a631db9
cmake 3.7.2 2019-05-07 19:18:17 +08:00
Steffen Schuemann
280a8590f9 Version bump, bugfix release v1.1.2 2019-05-05 09:28:03 +02:00
Steffen Schuemann
dc37276a9a Squashed commit of the following:
commit 8d9f245e379d373942c0f49be19dacc9293cdcf0
Merge: 3ceb4b0 857a355
Author: gulrak <s.schuemann@pobox.com>
Date:   Fri May 3 23:52:57 2019 +0200

    Merge branch 'development-v1.1' of https://github.com/gulrak/filesystem into development-v1.1

commit 3ceb4b0e4fe90be46b1fdbdfb7e2b3f160cccf3c
Author: gulrak <s.schuemann@pobox.com>
Date:   Fri May 3 23:51:48 2019 +0200

    Less noisy interoperability testing on weakly_canonial()

commit 38f82a90ef5f4ec1fa341ce3ab34f3836a6bd9ea
Author: gulrak <s.schuemann@pobox.com>
Date:   Fri May 3 23:50:43 2019 +0200

    Additional fix for recursive_directory_iterator

commit 857a3558fb13e8fae76e29b5b91cb76b5e98ea20
Merge: 9da5784 b557b5b
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Fri May 3 23:47:20 2019 +0200

    Merge branch 'development-v1.1' of github.com:gulrak/filesystem into development-v1.1

    # Conflicts:
    #	test/filesystem_test.cpp

commit 9da57846ac4de06c4b0521ab69ea42816fd6a029
Merge: 96e89ae 43e75c3
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Fri May 3 23:42:31 2019 +0200

    Merge remote-tracking branch 'origin/master' into development-v1.1

commit 96e89ae7f9e983cb3d0977d9ba77f421a0c06b0f
Merge: 9d71161 882c60b
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Fri May 3 23:40:18 2019 +0200

    Merge remote-tracking branch 'origin/master' into development-v1.1

commit b557b5b476c085183bd3da72cc9f511df3b52272
Merge: 263a2d2 9d71161
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Fri May 3 22:44:25 2019 +0200

    Merge branch 'development-v1.1' of https://github.com/gulrak/filesystem into development-v1.1

commit 263a2d2c5b9f25631513271a6e26a9cb66e8f9da
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Fri May 3 22:44:01 2019 +0200

    Work on Windows tests.

commit 9d71161323f22e994b51fda73ebc19af9e67d6e6
Author: Steffen Schuemann <s.schuemann@pobox.com>
Date:   Fri May 3 08:30:40 2019 +0200

    Fix for issues with recursive_directory_iterator not behaving like an input iterator and regarding pop()/depth().

commit 2ac1352b4a37fdb247b56fb63c1e2c3f56761649
Author: gulrak <s.schuemann@pobox.com>
Date:   Thu May 2 09:12:42 2019 +0200

    Refactored builds with std::fs to a CMake macro, added du example, added behaviour switch

commit 624a6f63e5639504c2b554ba89985ef9c01c6fa9
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Thu May 2 09:01:15 2019 +0200

    Add path parameters to filesystem_error::what
2019-05-05 08:51:53 +02:00
Steffen Schümann
da215a8c96 refs #12, fixed small issue with new recursive_directory_iterator tests on Windows due to not comparing generic format. 2019-05-04 09:16:36 +02:00
gulrak
e8ced30a84 Fixed merge error leading to compile error. 2019-05-04 08:59:21 +02:00
Steffen Schuemann
dac42f89aa Merge branch 'master' of github.com:gulrak/filesystem 2019-05-04 08:52:15 +02:00
Steffen Schuemann
2dd77916cf Updated readme 2019-05-04 08:51:42 +02:00
Steffen Schuemann
5ea334899a refs #12, added more tests to recursive directory iterator, fixed additional issue with pop(). 2019-05-04 08:47:41 +02:00
Steffen Schümann
3ef859bd2b Merge branch 'master' of https://github.com/gulrak/filesystem 2019-05-04 08:08:11 +02:00
Steffen Schümann
547ecfb28f Test helper for file_time_type got additional error checking 2019-05-04 08:08:04 +02:00
Steffen Schuemann
cce8c431c2 refs #12, multiple fixes for fs::recursive_directory_iterator concerning endless iterations, wrong pop and depth handling and better input_iterator_tag and copy semantics. 2019-05-04 00:11:16 +02:00
Steffen Schümann
43e75c3869 refs #11, added more tests 2019-05-03 23:14:05 +02:00
Steffen Schuemann
882c60baf2 refs #11, successive ".." sequences handeld wrong in lexically_normal() 2019-05-03 22:34:08 +02:00
32 changed files with 10640 additions and 3639 deletions

View File

@ -1,13 +1,61 @@
image: Visual Studio 2017
environment:
matrix:
- platform: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
generator: "Visual Studio 14 2015"
compiler: msvc
configuration: Release
platform:
- Win32
- x64
- platform: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
generator: "Visual Studio 14 2015 Win64"
compiler: msvc
configuration: Release
- platform: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
generator: "Visual Studio 15 2017"
compiler: msvc
configuration: Release
- platform: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
generator: "Visual Studio 15 2017 Win64"
compiler: msvc
configuration: Release
- platform: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
generator: "Visual Studio 16 2019"
compiler: msvc19
configuration: Release
arch: Win32
- platform: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
generator: "Visual Studio 16 2019"
compiler: msvc19
configuration: Release
arch: x64
- platform: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
generator: "MinGW Makefiles"
compiler: mingw
TOOLCHAIN_PATH: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32\bin
CC: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/gcc.exe
CXX: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++.exe
configuration: Release
- platform: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
generator: "MinGW Makefiles"
compiler: mingw
TOOLCHAIN_PATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin
CC: C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/gcc.exe
CXX: C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/g++.exe
configuration: Release
configuration:
- Debug
- Release
matrix:
fast_finish: false
@ -17,18 +65,21 @@ init:
install:
- cmd: reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
- cmd: ren "C:\Program Files\Git\usr\bin\sh.exe" _sh.exe
before_build:
- cmake . -Bbuild -A%PLATFORM% -DCMAKE_BUILD_TYPE=%configuration%
build:
project: build/ghcfilesystem.sln
parallel: true
verbosity: minimal
build_script:
- mkdir build
- cd build
- if [%compiler%]==[msvc] cmake -G"%generator%" ..
- if [%compiler%]==[msvc19] cmake -G"%generator%" -A "%arch%" ..
- if [%compiler%]==[mingw] set PATH=%TOOLCHAIN_PATH%;%PATH%
- if [%compiler%]==[mingw] cmake -G"%generator%" -DCMAKE_C_COMPILER=%CC% -DCMAKE_CXX_COMPILER=%CXX% -DCMAKE_SH=CMAKE_SH-NOTFOUND -DCMAKE_BUILD_TYPE=%configuration% ..
- cmake --build . --config %configuration%
test_script:
- cd build
- cd %APPVEYOR_BUILD_FOLDER%\build
- set CTEST_OUTPUT_ON_FAILURE=1
- ctest -C %configuration%
- if exist "test\Release\std_filesystem_test.exe" test\Release\std_filesystem_test.exe & exit 0
- cd ..

4
.ci/unix-build.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .

7
.ci/unix-test.sh Executable file
View File

@ -0,0 +1,7 @@
#!/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
fi

34
.cirrus.yml Normal file
View File

@ -0,0 +1,34 @@
freebsd_task:
freebsd_instance:
image_family: freebsd-14-0
install_script: |
pkg install -y cmake
pw groupadd testgrp
pw useradd testuser -g testgrp -w none -m
chown -R testuser:testgrp .
build_script: |
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

View File

@ -21,5 +21,5 @@ BraceWrapping:
SplitEmptyNamespace: true
BreakConstructorInitializers: BeforeComma
ConstructorInitializerAllOnOneLineOrOnePerLine: false
IndentPPDirectives: None
...

3
.clang-tidy Normal file
View File

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

43
.drone.yml-disabled Normal file
View File

@ -0,0 +1,43 @@
kind: pipeline
name: arm
platform:
os: linux
arch: arm
steps:
- name: build
image: alpine
failure: ignore
commands:
- apk update
- apk add --no-cache build-base cmake sudo
- addgroup testgrp
- adduser --disabled-password testuser testgrp
- passwd testuser -u -d
- chown -R testuser:testgrp .
- sudo -u testuser .ci/unix-build.sh
- sudo -u testuser .ci/unix-test.sh
---
kind: pipeline
name: arm64
platform:
os: linux
arch: arm64
steps:
- name: build
image: alpine
failure: ignore
commands:
- apk update
- apk add --no-cache build-base cmake
- addgroup testgrp
- adduser --disabled-password testuser testgrp
- passwd testuser -u -d
- chown -R testuser:testgrp .
- su -c "./.ci/unix-build.sh" testuser
- su -c "./.ci/unix-test.sh" testuser

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 }}

8
.gitignore vendored
View File

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

View File

@ -1,60 +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'"
addons: { apt: { packages: ["g++-5"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && GENERATOR='Unix Makefiles'"
addons: { apt: { packages: ["g++-6"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && GENERATOR='Unix Makefiles'"
addons: { apt: { packages: ["g++-7"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8 && GENERATOR='Unix Makefiles'"
addons: { apt: { packages: ["g++-8"], sources: ["ubuntu-toolchain-r-test"] } }
- env: MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0 && GENERATOR='Unix Makefiles'"
addons: { apt: { packages: ["clang-5.0"] } }
- env: MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0 && GENERATOR='Unix Makefiles'"
addons: { apt: { packages: ["clang-6.0"] } }
- env: MATRIX_EVAL="CC=clang-7 && CXX=clang++-7 && GENERATOR='Unix Makefiles'"
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'"
addons: { apt: { packages: ["clang-8", "libc++-8-dev", "libc++abi-8-dev"], sources: ["llvm-toolchain-xenial-8"] } }
- os: osx
env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode"
osx_image: xcode9.2
install:
- eval "${MATRIX_EVAL}"
- |
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
brew update
brew upgrade cmake
fi
- $CC --version
- $CXX --version
- cmake --version
before_script:
- mkdir build
- cd build
- export VERBOSE=1
- cmake -G"${GENERATOR}" -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} ..
script:
- export VERBOSE=1
- cmake --build . --config Release
- ctest -C Release -E Windows

View File

@ -1,31 +1,90 @@
cmake_minimum_required(VERSION 3.9)
project(ghcfilesystem)
cmake_minimum_required(VERSION 3.7.2)
project(
ghcfilesystem,
VERSION 1.5.15
)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
if(POLICY CMP0110)
cmake_policy(SET CMP0110 NEW)
endif()
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)
target_sources(ghc_filesystem INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/filesystem.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_fwd.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_fwd.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_impl.hpp
)
target_include_directories(ghc_filesystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
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)
enable_testing()
add_subdirectory(test)
add_subdirectory(examples)
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)
if(GHC_FILESYSTEM_BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
if(GHC_FILESYSTEM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
endif()
if(GHC_FILESYSTEM_WITH_INSTALL)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
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()

38
LICENSE
View File

@ -1,27 +1,19 @@
Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

982
README.md

File diff suppressed because it is too large Load Diff

81
cmake/GhcHelper.cmake Normal file
View File

@ -0,0 +1,81 @@
macro(AddExecutableWithStdFS targetName)
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)
endif()
add_executable(${targetName} ${ARGN})
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
if(APPLE)
target_link_libraries(${targetName} -lc++fs)
else()
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
target_link_libraries(${targetName} -stdlib=libc++ -lc++fs $<$<PLATFORM_ID:Linux>:rt>)
endif()
else()
if(NOT APPLE)
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
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()
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
add_executable(${targetName} ${ARGN})
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
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()
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
add_executable(${targetName} ${ARGN})
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD_REQUIRED ON)
target_compile_options(${targetName} PRIVATE "/Zc:__cplusplus")
target_compile_definitions(${targetName} PRIVATE USE_STD_FS _CRT_SECURE_NO_WARNINGS)
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()

6
cmake/config.cmake.in Normal file
View File

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

View File

@ -4,34 +4,14 @@ target_link_libraries(fs_dir ghc_filesystem)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(fs_dir PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
AddExecutableWithStdFS(std_fs_dir dir.cpp)
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(APPLE)
include_directories(/usr/local/opt/llvm/include)
link_directories(/usr/local/opt/llvm/lib)
endif()
add_executable(std_fs_dir dir.cpp)
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD 17)
if(APPLE)
target_link_libraries(std_fs_dir -lc++fs)
else()
target_compile_options(std_fs_dir PRIVATE "-stdlib=libc++")
target_link_libraries(std_fs_dir -stdlib=libc++ -lc++fs)
endif()
add_executable(fs_du du.cpp)
target_link_libraries(fs_du ghc_filesystem)
AddExecutableWithStdFS(std_fs_du du.cpp)
target_link_libraries(std_fs_dir -lc++fs)
endif()
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
add_executable(std_fs_dir dir.cpp)
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD 17)
target_link_libraries(std_fs_dir -lstdc++fs)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
add_executable(std_fs_dir dir.cpp)
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD 17)
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD_REQUIRED ON)
target_compile_options(std_fs_dir PRIVATE "/Zc:__cplusplus")
target_compile_definitions(std_fs_dir PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
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()

View File

@ -1,16 +1,21 @@
#include <iostream>
#include <iomanip>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <string>
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && __has_include(<filesystem>)
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#include <filesystem>
namespace fs = std::filesystem;
#else
#endif
#endif
#ifndef GHC_USE_STD_FS
#include <ghc/filesystem.hpp>
namespace fs = ghc::filesystem;
#endif
template<typename TP>
template <typename TP>
std::time_t to_time_t(TP tp)
{
// Based on trick from: Nico Josuttis, C++17 - The Complete Guide
@ -22,8 +27,8 @@ static std::string perm_to_str(fs::perms prms)
{
std::string result;
result.reserve(9);
for(int i = 0; i < 9; ++i) {
result = ((static_cast<int>(prms) & (1<<i)) ? "xwrxwrxwr"[i] : '-') + result;
for (int i = 0; i < 9; ++i) {
result = ((static_cast<int>(prms) & (1 << i)) ? "xwrxwrxwr"[i] : '-') + result;
}
return result;
}
@ -32,27 +37,24 @@ int main(int argc, char* argv[])
{
#ifdef GHC_FILESYSTEM_VERSION
fs::u8arguments u8guard(argc, argv);
if(!u8guard.valid()) {
if (!u8guard.valid()) {
std::cerr << "Invalid character encoding, UTF-8 based encoding needed." << std::endl;
std::exit(EXIT_FAILURE);
}
#endif
if(argc > 2) {
if (argc > 2) {
std::cerr << "USAGE: dir <path>" << std::endl;
exit(1);
}
fs::path dir{"."};
if(argc == 2) {
if (argc == 2) {
dir = fs::u8path(argv[1]);
}
for(auto de : fs::directory_iterator(dir)) {
for (auto de : fs::directory_iterator(dir)) {
auto ft = to_time_t(de.last_write_time());
auto ftm = *std::localtime(&ft);
std::cout << (de.is_directory() ? "d" : "-") << perm_to_str(de.symlink_status().permissions()) << " "
<< std::setw(8) << (de.is_directory() ? "-" : std::to_string(de.file_size())) << " "
<< std::put_time(&ftm, "%Y-%m-%d %H:%M:%S") << " "
<< de.path().filename().string()
<< std::endl;
std::cout << (de.is_directory() ? "d" : "-") << perm_to_str(de.symlink_status().permissions()) << " " << std::setw(8) << (de.is_directory() ? "-" : std::to_string(de.file_size())) << " " << std::put_time(&ftm, "%Y-%m-%d %H:%M:%S") << " "
<< de.path().filename().string() << std::endl;
}
return 0;
}

61
examples/du.cpp Normal file
View File

@ -0,0 +1,61 @@
#include <iostream>
#include <iomanip>
#include <chrono>
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#include <filesystem>
namespace fs = std::filesystem;
#endif
#endif
#ifndef GHC_USE_STD_FS
#include <ghc/filesystem.hpp>
namespace fs = ghc::filesystem;
#endif
int main(int argc, char* argv[])
{
#ifdef GHC_FILESYSTEM_VERSION
fs::u8arguments u8guard(argc, argv);
if(!u8guard.valid()) {
std::cerr << "Invalid character encoding, UTF-8 based encoding needed." << std::endl;
std::exit(EXIT_FAILURE);
}
#endif
if(argc > 2) {
std::cerr << "USAGE: du <path>" << std::endl;
exit(1);
}
fs::path dir{"."};
if(argc == 2) {
dir = fs::u8path(argv[1]);
}
uint64_t totalSize = 0;
int totalDirs = 0;
int totalFiles = 0;
int maxDepth = 0;
try {
auto rdi = fs::recursive_directory_iterator(dir);
for(auto de : rdi) {
if(rdi.depth() > maxDepth) {
maxDepth = rdi.depth();
}
if(de.is_regular_file()) {
totalSize += de.file_size();
++totalFiles;
}
else if(de.is_directory()) {
++totalDirs;
}
}
}
catch(fs::filesystem_error fe) {
std::cerr << "Error: " << fe.what() << std::endl;
exit(1);
}
std::cout << totalSize << " bytes in " << totalFiles << " files and " << totalDirs << " directories, maximum depth: " << maxDepth << std::endl;
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -5,35 +5,27 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// 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,
@ -42,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

@ -5,39 +5,31 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// 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

@ -5,55 +5,73 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
// fs_std.hpp - The dynamic switching header for that includes std::filesystem if detected
// fs_std.hpp - The dynamic switching header that includes std::filesystem if detected
// or ghc::filesystem if not, and makes the resulting API available in the
// namespace fs.
//---------------------------------------------------------------------------------------
#ifndef GHC_FILESYSTEM_STD_H
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && __has_include(<filesystem>)
#include <filesystem>
namespace fs {
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
}
#else
#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

@ -5,35 +5,27 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// 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,
@ -41,23 +33,47 @@
//---------------------------------------------------------------------------------------
#ifndef GHC_FILESYSTEM_STD_FWD_H
#define GHC_FILESYSTEM_STD_FWD_H
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && __has_include(<filesystem>)
#include <filesystem>
namespace fs {
using namespace std::filesystem;
using ifstream = std::ifstream;
using ofstream = std::ofstream;
using fstream = std::fstream;
}
#else
#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

@ -5,42 +5,56 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// 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) && __has_include(<filesystem>))
#define GHC_FILESYSTEM_IMPLEMENTATION
#include <ghc/filesystem.hpp>
#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
#include "fs_impl.hpp"
#endif

View File

@ -3,48 +3,80 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
set(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON)
include(ParseAndAddCatchTests)
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 -Werror>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS)
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()
if(CMAKE_GENERATOR STREQUAL Xcode)
add_executable(filesystem_test_cov filesystem_test.cpp catch.hpp)
target_compile_options(filesystem_test_cov PRIVATE "$<$<CONFIG:DEBUG>:--coverage>")
target_link_libraries(filesystem_test_cov PUBLIC ghc_filesystem PRIVATE --coverage)
endif()
ParseAndAddCatchTests(filesystem_test filesystem_test)
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(APPLE)
include_directories(/usr/local/opt/llvm/include)
link_directories(/usr/local/opt/llvm/lib)
endif()
add_executable(std_filesystem_test filesystem_test.cpp catch.hpp)
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS)
if(APPLE)
target_link_libraries(std_filesystem_test -lc++fs)
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")
add_executable(filesystem_test filesystem_test.cpp catch.hpp)
if(MINGW)
target_compile_options(filesystem_test PUBLIC --coverage "-Wa,-mbig-obj")
else()
target_compile_options(std_filesystem_test PRIVATE "-stdlib=libc++")
target_link_libraries(std_filesystem_test -stdlib=libc++ -lc++fs)
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)
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 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)
if(GHC_FILESYSTEM_BUILD_STD_TESTING)
AddExecutableWithStdFS(std_filesystem_test filesystem_test.cpp catch.hpp)
endif()
if(WIN32)
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_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
else()
target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
endif()
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()
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
add_executable(std_filesystem_test filesystem_test.cpp catch.hpp)
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS)
target_link_libraries(std_filesystem_test -lstdc++fs)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
add_executable(std_filesystem_test filesystem_test.cpp catch.hpp)
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
target_compile_options(std_filesystem_test PRIVATE "/Zc:__cplusplus")
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS _CRT_SECURE_NO_WARNINGS)
endif()
add_executable(multifile_test multi1.cpp multi2.cpp catch.hpp)
@ -53,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

@ -1,32 +1,24 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
#define CATCH_CONFIG_MAIN
@ -35,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]")

View File

@ -1,32 +1,24 @@
//---------------------------------------------------------------------------------------
//
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//---------------------------------------------------------------------------------------
#include "catch.hpp"