diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:13:36 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:13:36 -0500 |
| commit | 2800fa3bc682c82e579d9cc1dbf5c00d2a484ab7 (patch) | |
| tree | 56f230b92677154299510b64133fd44f684535a9 /runtime/test/file_system_test.cpp | |
| parent | 50c4cfefe2cc8734d91057910e4cd3ac91be7e65 (diff) | |
| parent | 844e650bfabc57342ece360830a4cc72fc59b6c8 (diff) | |
Merge pull request #4328 from Maxime Mansiet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/file_system_test.cpp')
| -rw-r--r-- | runtime/test/file_system_test.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp index a36dcba37..bc0711edb 100644 --- a/runtime/test/file_system_test.cpp +++ b/runtime/test/file_system_test.cpp | |||
| @@ -879,6 +879,47 @@ int main() { | |||
| 879 | GetLastError() == ERROR_INVALID_NAME, | 879 | GetLastError() == ERROR_INVALID_NAME, |
| 880 | "G:\\.. is refused with ERROR_INVALID_NAME"); | 880 | "G:\\.. is refused with ERROR_INVALID_NAME"); |
| 881 | 881 | ||
| 882 | int fresh_count = 0; | ||
| 883 | auto fresh_overlay = [&] { | ||
| 884 | const std::filesystem::path dir = root / ("fresh_overlay" + std::to_string(++fresh_count)); | ||
| 885 | rt::fs::configure(package, dir); | ||
| 886 | return dir; | ||
| 887 | }; | ||
| 888 | fresh_overlay(); | ||
| 889 | SetLastError(0); | ||
| 890 | const DWORD t_root = attributes_w(L"T:\\"); | ||
| 891 | check(t_root != INVALID_FILE_ATTRIBUTES && (t_root & FILE_ATTRIBUTE_DIRECTORY) != 0 && GetLastError() == 0, | ||
| 892 | "on a fresh overlay GetFileAttributesW(T:\\) is a folder, and making it leaves the last error alone"); | ||
| 893 | fresh_overlay(); | ||
| 894 | const std::vector<std::wstring> t_names = list(first_w, next_w, find_close, L"T:\\*"); | ||
| 895 | check(t_names.size() == 2 && count(t_names, L".") == 1 && count(t_names, L"..") == 1, | ||
| 896 | "on a fresh overlay FindFirstFileW(T:\\*) lists the empty root as . and .."); | ||
| 897 | fresh_overlay(); | ||
| 898 | check(mkdir_w(L"T:\\shadercache", nullptr) != FALSE, | ||
| 899 | "on a fresh overlay CreateDirectoryW(T:\\shadercache) succeeds"); | ||
| 900 | std::filesystem::path fresh = fresh_overlay(); | ||
| 901 | check(copy_w(L"GAME:\\data\\hello.txt", L"T:\\hello.tmp", FALSE) != FALSE && | ||
| 902 | read_path(fresh / ".gta6rt-temp" / "hello.tmp") == "package", | ||
| 903 | "on a fresh overlay CopyFileW(GAME:\\data\\hello.txt, T:\\hello.tmp) succeeds"); | ||
| 904 | fresh = fresh_overlay(); | ||
| 905 | SetLastError(0); | ||
| 906 | check(rmdir_w(L"T:\\") == FALSE && GetLastError() == ERROR_ACCESS_DENIED && | ||
| 907 | std::filesystem::is_directory(fresh / ".gta6rt-temp"), | ||
| 908 | "T:\\ cannot be removed, like GAME:\\"); | ||
| 909 | fresh = fresh_overlay(); | ||
| 910 | SetLastError(0); | ||
| 911 | check(move_w(L"T:\\", L"GAME:\\moved") == FALSE && GetLastError() == ERROR_ACCESS_DENIED && | ||
| 912 | attributes_w(L"GAME:\\moved") == INVALID_FILE_ATTRIBUTES && | ||
| 913 | std::filesystem::is_directory(fresh / ".gta6rt-temp"), | ||
| 914 | "T:\\ cannot be moved"); | ||
| 915 | fresh_overlay(); | ||
| 916 | attributes_w(L"T:\\"); | ||
| 917 | SetLastError(0); | ||
| 918 | const BOOL removed_by_game_path = rmdir_w(L"GAME:\\.gta6rt-temp"); | ||
| 919 | check(removed_by_game_path != FALSE || GetLastError() != ERROR_ACCESS_DENIED, | ||
| 920 | "only a T: path names the T:\\ root: GAME:\\.gta6rt-temp is not refused as a drive root"); | ||
| 921 | rt::fs::configure(package, overlay); | ||
| 922 | |||
| 882 | h = create_w(L"T:\\cache\\scratch.bin", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr); | 923 | h = create_w(L"T:\\cache\\scratch.bin", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr); |
| 883 | check(h != INVALID_HANDLE_VALUE, "CreateFileW creates a file on T: (parent folders and all)"); | 924 | check(h != INVALID_HANDLE_VALUE, "CreateFileW creates a file on T: (parent folders and all)"); |
| 884 | if (h != INVALID_HANDLE_VALUE) { | 925 | if (h != INVALID_HANDLE_VALUE) { |