mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
refs #55, fs::create_directories reported true if it didn't need to create anything.
This commit is contained in:
parent
70a0085a47
commit
d93ccea812
@ -3397,6 +3397,7 @@ GHC_INLINE bool create_directories(const path& p, std::error_code& ec) noexcept
|
||||
{
|
||||
path current;
|
||||
ec.clear();
|
||||
bool didCreate = false;
|
||||
for (path::string_type part : p) {
|
||||
current /= part;
|
||||
if (current != p.root_name() && current != p.root_path()) {
|
||||
@ -3416,6 +3417,7 @@ GHC_INLINE bool create_directories(const path& p, std::error_code& ec) noexcept
|
||||
return false;
|
||||
}
|
||||
}
|
||||
didCreate = true;
|
||||
}
|
||||
#ifndef LWG_2935_BEHAVIOUR
|
||||
else if (!is_directory(fs)) {
|
||||
@ -3425,7 +3427,7 @@ GHC_INLINE bool create_directories(const path& p, std::error_code& ec) noexcept
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return didCreate;
|
||||
}
|
||||
|
||||
GHC_INLINE bool create_directory(const path& p)
|
||||
|
@ -19,7 +19,7 @@ else()
|
||||
target_link_libraries(filesystem_test ghc_filesystem)
|
||||
target_compile_options(filesystem_test PRIVATE
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-psabi>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
|
@ -1674,6 +1674,7 @@ TEST_CASE("30.10.15.6 create_directories", "[filesystem][operations][fs.op.creat
|
||||
CHECK(fs::create_directories(p2));
|
||||
CHECK(fs::is_directory(p));
|
||||
CHECK(fs::is_directory(p2));
|
||||
CHECK(!fs::create_directories(p2));
|
||||
#ifdef TEST_LWG_2935_BEHAVIOUR
|
||||
INFO("This test expects LWG #2935 result conformance.");
|
||||
p = t.path() / "testfile";
|
||||
|
Loading…
x
Reference in New Issue
Block a user