diff options
| author | gabrielsteglich <63128571+gabrielsteglich@users.noreply.github.com> | 2026-11-23 16:50:23 -0300 |
|---|---|---|
| committer | gabrielsteglich <63128571+gabrielsteglich@users.noreply.github.com> | 2026-11-23 16:50:23 -0300 |
| commit | 3101e317afdac5a8fd0342d3fd86d9a3c107701d (patch) | |
| tree | 7961526c65d85438cd939e378f81e8d1b9331b07 /runtime/test/file_system_test.cpp | |
| parent | 17f41ec69c472ff3283284b8df6c589e561b74cd (diff) | |
Preserve trailing-dot DOS file search patterns on long paths
Diffstat (limited to 'runtime/test/file_system_test.cpp')
| -rw-r--r-- | runtime/test/file_system_test.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp index 50b3a7aa2..e7e5e0e06 100644 --- a/runtime/test/file_system_test.cpp +++ b/runtime/test/file_system_test.cpp | |||
| @@ -1453,6 +1453,38 @@ void run_checks(const std::filesystem::path& root) { | |||
| 1453 | check(attributes_w((guest_dir + L"legacy.bin").c_str()) == INVALID_FILE_ATTRIBUTES, | 1453 | check(attributes_w((guest_dir + L"legacy.bin").c_str()) == INVALID_FILE_ATTRIBUTES, |
| 1454 | "a read-only query respects the long file's delete marker"); | 1454 | "a read-only query respects the long file's delete marker"); |
| 1455 | 1455 | ||
| 1456 | // Compare the same merged listing against the short-path Win32 search, including the names | ||
| 1457 | // hidden by package deletion markers. | ||
| 1458 | const wchar_t* const masks[] = {L"*.", L"?.", L"mesh*.", L"mesh*..", L"mesh?.", L"mesh.*.", | ||
| 1459 | L"*.?.", L"*. ", L"*.*", L"mesh?.txt"}; | ||
| 1460 | const auto list_masks = [&](const std::filesystem::path& pack, const std::filesystem::path& layer, | ||
| 1461 | const std::filesystem::path& subdir) { | ||
| 1462 | for (const wchar_t* name : {L"a", L"a.txt", L"mesh", L"mesh1", L"mesh.txt", L"mesh-old", L".dot"}) | ||
| 1463 | write_path(extended(pack / subdir / name), "package"); | ||
| 1464 | for (const wchar_t* name : {L"mesh", L"mesh-cache", L"mesh-cache.tmp"}) | ||
| 1465 | write_path(extended(layer / subdir / name), "overlay"); | ||
| 1466 | rt::fs::configure(pack, layer); | ||
| 1467 | const auto guest = L"GAME:\\" + subdir.native() + L"\\"; | ||
| 1468 | check(delete_w((guest + L"mesh-old").c_str()), "the wildcard fixture hides an extensionless package file"); | ||
| 1469 | std::vector<std::vector<std::wstring>> results; | ||
| 1470 | for (const wchar_t* mask : masks) { | ||
| 1471 | auto entries = list(first_w, next_w, find_close, (guest + mask).c_str()); | ||
| 1472 | std::sort(entries.begin(), entries.end()); | ||
| 1473 | results.push_back(std::move(entries)); | ||
| 1474 | } | ||
| 1475 | return results; | ||
| 1476 | }; | ||
| 1477 | const auto short_matches = list_masks(fixture / "short_package", fixture / "short_overlay", L"masks"); | ||
| 1478 | const auto long_matches = list_masks(long_package, long_overlay, relative / L"masks"); | ||
| 1479 | check(count(short_matches[0], L"mesh") == 1 && contains(short_matches[0], L"mesh-cache") && | ||
| 1480 | !contains(short_matches[0], L"mesh.txt") && !contains(short_matches[0], L"mesh-old"), | ||
| 1481 | "the short *. control merges extensionless entries and hides the deleted name"); | ||
| 1482 | for (size_t i = 0; i < short_matches.size(); ++i) { | ||
| 1483 | char detail[96]; | ||
| 1484 | std::snprintf(detail, sizeof detail, "the long listing matches short Win32 for %ls", masks[i]); | ||
| 1485 | check(long_matches[i] == short_matches[i], detail); | ||
| 1486 | } | ||
| 1487 | |||
| 1456 | // The scratch drive is usable with a short guest name and a long configured overlay root. | 1488 | // The scratch drive is usable with a short guest name and a long configured overlay root. |
| 1457 | const auto scratch_overlay = fixture / relative / "scratch_overlay"; | 1489 | const auto scratch_overlay = fixture / relative / "scratch_overlay"; |
| 1458 | rt::fs::configure(long_package, scratch_overlay); | 1490 | rt::fs::configure(long_package, scratch_overlay); |