diff options
| author | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 22:24:36 +0100 |
|---|---|---|
| committer | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 22:24:36 +0100 |
| commit | 68e20ecff8f020bf95b514afb3b51023dfb1e63c (patch) | |
| tree | 45f1f49f24bb161ebca21689daaec1b7f25facb7 /runtime/test/file_system_test.cpp | |
| parent | 5d74c272363f2703265d44e6aaab1a1df8ddfaf3 (diff) | |
file_system: clear marker when recreating directory
Diffstat (limited to 'runtime/test/file_system_test.cpp')
| -rw-r--r-- | runtime/test/file_system_test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp index 2ebc339e4..70c9f3a6f 100644 --- a/runtime/test/file_system_test.cpp +++ b/runtime/test/file_system_test.cpp | |||
| @@ -709,6 +709,24 @@ void run_checks(const std::filesystem::path& root) { | |||
| 709 | "and the new folder is empty: only . and .."); | 709 | "and the new folder is empty: only . and .."); |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | // Recreating a removed package directory clears its own marker, but not nested deletion markers. | ||
| 713 | { | ||
| 714 | std::filesystem::create_directories(package / "recreate_dir"); | ||
| 715 | const auto mark = overlay / ".gta6rt-deleted" / "recreate_dir" / ".gta6rt-dir"; | ||
| 716 | check(rmdir_w(L"GAME:\\recreate_dir") != FALSE && std::filesystem::exists(mark), | ||
| 717 | "removing a package directory creates its marker"); | ||
| 718 | check(mkdir_w(L"GAME:\\recreate_dir", nullptr) != FALSE, "recreating the package directory succeeds"); | ||
| 719 | const DWORD attrs = attributes_w(L"GAME:\\recreate_dir"); | ||
| 720 | check(attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY), "recreated directory has directory attributes"); | ||
| 721 | check(count(list(first_w, next_w, find_close, L"GAME:\\*"), L"recreate_dir") == 1, | ||
| 722 | "recreated directory is listed once"); | ||
| 723 | check(!std::filesystem::exists(mark), "recreated directory has no removal marker"); | ||
| 724 | check(mkdir_w(L"GAME:\\never_removed_dir", nullptr) != FALSE && | ||
| 725 | std::filesystem::is_directory(overlay / "never_removed_dir") && | ||
| 726 | !std::filesystem::exists(overlay / ".gta6rt-deleted" / "never_removed_dir"), | ||
| 727 | "creating a never-removed directory is unchanged"); | ||
| 728 | } | ||
| 729 | |||
| 712 | // MoveFile: the destination is in the overlay; a moved package file is deleted by a marker. | 730 | // MoveFile: the destination is in the overlay; a moved package file is deleted by a marker. |
| 713 | { | 731 | { |
| 714 | check(move_w(L"GAME:\\misc\\one.txt", L"GAME:\\misc\\moved.txt") != FALSE, "MoveFileW moves a package file"); | 732 | check(move_w(L"GAME:\\misc\\one.txt", L"GAME:\\misc\\moved.txt") != FALSE, "MoveFileW moves a package file"); |