mirror of
https://github.com/gulrak/filesystem.git
synced 2026-05-01 03:19:11 +08:00
fix create_directories for windows long paths
add a test
This commit is contained in:
parent
4e21ab3057
commit
da2bf997be
@ -3902,7 +3902,7 @@ GHC_INLINE bool create_directories(const path& p, std::error_code& ec) noexcept
|
||||
bool didCreate = false;
|
||||
for (path::string_type part : p) {
|
||||
current /= part;
|
||||
if (current != p.root_name() && current != p.root_path()) {
|
||||
if (current != p.root_name() && current != p.root_path() && current != GHC_PLATFORM_LITERAL("\\\\?\\")) {
|
||||
std::error_code tec;
|
||||
auto fs = status(current, tec);
|
||||
if (tec && fs.type() != file_type::not_found) {
|
||||
|
||||
@ -2861,6 +2861,12 @@ TEST_CASE("Windows: Long filename support", "[filesystem][path][fs.path.win.long
|
||||
}
|
||||
}
|
||||
CHECK(c <= 'Z');
|
||||
|
||||
fs::remove(fs::current_path().u8string() + std::string(16, 'A'));
|
||||
CHECK_NOTHROW(fs::create_directories(dir));
|
||||
CHECK(fs::exists(dir));
|
||||
generateFile(dir / "f0");
|
||||
CHECK(fs::exists(dir / "f0"));
|
||||
#else
|
||||
WARN("Windows specific tests are empty on non-Windows systems.");
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user