From 815ce11d2b679627283e1d37c48b10d019b1b051 Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:46:37 +0300 Subject: [PATCH] fs: Defeat games with double slashes --- src/core/file_sys/fs.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/file_sys/fs.cpp b/src/core/file_sys/fs.cpp index c6bdf7ad..2f57c9f3 100644 --- a/src/core/file_sys/fs.cpp +++ b/src/core/file_sys/fs.cpp @@ -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) {