fs: Defeat games with double slashes

This commit is contained in:
IndecisiveTurtle 2024-07-17 14:46:37 +03:00
parent 7ad44317f8
commit 815ce11d2b
1 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,11 @@ std::filesystem::path MntPoints::GetHostPath(const std::string& guest_directory)
}
// Remove device (e.g /app0) from path to retrieve relative path.
const u32 pos = mount->mount.size() + 1;
u32 pos = mount->mount.size() + 1;
// Evil games like Turok2 pass double slashes e.g /app0//game.kpf
if (guest_directory[pos] == '/') {
pos++;
}
const auto rel_path = std::string_view(guest_directory).substr(pos);
const auto host_path = mount->host_path / rel_path;
if (!NeedsCaseInsensiveSearch) {