mirror of
https://github.com/gulrak/filesystem.git
synced 2025-12-06 16:56:40 +08:00
Merge remote-tracking branch 'origin/master' into glibcxx_wchar_streams_workaround
This commit is contained in:
commit
983650f374
@ -397,6 +397,10 @@ The `CMakeLists.txt` offers a few options to customize its behavior:
|
||||
`CMAKE_CXX_COMPILE_FEATURES` when the detection of C++17 or C++20 for additional tests
|
||||
is not working (e.g. `cxx_std_20` to enforce building a `filesystem_test_cpp20` with C++20).
|
||||
|
||||
### Bazel
|
||||
|
||||
Please use [hedronvision/bazel-cc-filesystem-backport](https://github.com/hedronvision/bazel-cc-filesystem-backport), which will automatically set everything up for you.
|
||||
|
||||
### Versioning
|
||||
|
||||
There is a version macro `GHC_FILESYSTEM_VERSION` defined in case future changes
|
||||
|
||||
@ -3431,6 +3431,9 @@ GHC_INLINE path path::lexically_relative(const path& base) const
|
||||
--count;
|
||||
}
|
||||
}
|
||||
if (count == 0 && (a == end() || a->empty())) {
|
||||
return path(".");
|
||||
}
|
||||
if (count < 0) {
|
||||
return path();
|
||||
}
|
||||
@ -4099,7 +4102,7 @@ GHC_INLINE bool copy_file(const path& from, const path& to, copy_options options
|
||||
}
|
||||
ssize_t br, bw;
|
||||
while (true) {
|
||||
do { br = ::read(in, buffer.data(), buffer.size()); } while(errno == EINTR);
|
||||
do { br = ::read(in, buffer.data(), buffer.size()); } while(errno == EINTR && !br);
|
||||
if(!br) {
|
||||
break;
|
||||
}
|
||||
@ -5818,7 +5821,7 @@ public:
|
||||
, _entry(nullptr)
|
||||
{
|
||||
if (!path.empty()) {
|
||||
do { _dir = ::opendir(path.native().c_str()); } while(errno == EINTR);
|
||||
do { _dir = ::opendir(path.native().c_str()); } while(errno == EINTR && !_dir);
|
||||
if (!_dir) {
|
||||
auto error = errno;
|
||||
_base = filesystem::path();
|
||||
@ -5845,7 +5848,7 @@ public:
|
||||
do {
|
||||
skip = false;
|
||||
errno = 0;
|
||||
do { _entry = ::readdir(_dir); } while(errno == EINTR);
|
||||
do { _entry = ::readdir(_dir); } while(errno == EINTR && !_entry);
|
||||
if (_entry) {
|
||||
_dir_entry._path = _base;
|
||||
_dir_entry._path.append_name(_entry->d_name);
|
||||
|
||||
@ -965,6 +965,10 @@ TEST_CASE("fs.path.gen - path generation", "[filesystem][path][fs.path.gen]")
|
||||
// lexically_relative()
|
||||
CHECK(fs::path("/a/d").lexically_relative("/a/b/c") == "../../d");
|
||||
CHECK(fs::path("/a/b/c").lexically_relative("/a/d") == "../b/c");
|
||||
CHECK(fs::path("/a/b/c").lexically_relative("/a/b/c/d/..") == ".");
|
||||
CHECK(fs::path("/a/b/c/").lexically_relative("/a/b/c/d/..") == ".");
|
||||
CHECK(fs::path("").lexically_relative("/a/..") == "");
|
||||
CHECK(fs::path("").lexically_relative("a/..") == ".");
|
||||
CHECK(fs::path("a/b/c").lexically_relative("a") == "b/c");
|
||||
CHECK(fs::path("a/b/c").lexically_relative("a/b/c/x/y") == "../..");
|
||||
CHECK(fs::path("a/b/c").lexically_relative("a/b/c") == ".");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user