diff options
Diffstat (limited to 'runtime/shims/file_system.cpp')
| -rw-r--r-- | runtime/shims/file_system.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/runtime/shims/file_system.cpp b/runtime/shims/file_system.cpp index 8efe705cb..2a31b664d 100644 --- a/runtime/shims/file_system.cpp +++ b/runtime/shims/file_system.cpp | |||
| @@ -986,8 +986,18 @@ BOOL create_directory(LPCWSTR template_name, LPCWSTR name, LPSECURITY_ATTRIBUTES | |||
| 986 | std::error_code ec; | 986 | std::error_code ec; |
| 987 | std::filesystem::create_directories(target.parent_path(), ec); | 987 | std::filesystem::create_directories(target.parent_path(), ec); |
| 988 | if (ec) return fail_bool(static_cast<DWORD>(ec.value())); | 988 | if (ec) return fail_bool(static_cast<DWORD>(ec.value())); |
| 989 | return template_name ? ::CreateDirectoryExW(template_path.c_str(), target.c_str(), security) | 989 | const BOOL created = template_name ? ::CreateDirectoryExW(template_path.c_str(), target.c_str(), security) |
| 990 | : ::CreateDirectoryW(target.c_str(), security); | 990 | : ::CreateDirectoryW(target.c_str(), security); |
| 991 | if (created) { | ||
| 992 | // Keep markers for deleted children, which must remain hidden after the folder is recreated. | ||
| 993 | std::filesystem::remove(marker(r.overlay, parts) / kRemovedDirMarker, ec); | ||
| 994 | if (ec) { | ||
| 995 | const DWORD error = static_cast<DWORD>(ec.value()); | ||
| 996 | ::RemoveDirectoryW(target.c_str()); | ||
| 997 | return fail_bool(error); | ||
| 998 | } | ||
| 999 | } | ||
| 1000 | return created; | ||
| 991 | } | 1001 | } |
| 992 | 1002 | ||
| 993 | } // namespace | 1003 | } // namespace |