From caad11b30bfd8332789b18c4edc515d0953db82a Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 4 Jan 2015 20:57:12 -0800 Subject: [PATCH] Support root-relative paths. --- src/xenia/kernel/fs/filesystem.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/fs/filesystem.cc b/src/xenia/kernel/fs/filesystem.cc index e3b37bb89..760c9329d 100644 --- a/src/xenia/kernel/fs/filesystem.cc +++ b/src/xenia/kernel/fs/filesystem.cc @@ -151,12 +151,19 @@ std::unique_ptr FileSystem::ResolvePath(const std::string& path) { // TODO(benvanik): normalize path/etc // e.g., remove ..'s and such + // If no path (starts with a slash) do it module-relative. + // Which for now, we just make game:. + std::string normalized_path = path; + if (path[0] == '\\') { + normalized_path = "game:" + normalized_path; + } + // Resolve symlinks. // TODO(benvanik): more robust symlink handling - right now we assume simple // drive path -> device mappings with nothing nested. - std::string full_path = path; + std::string full_path = normalized_path; for (const auto& it : symlinks_) { - if (poly::find_first_of_case(path, it.first) == 0) { + if (poly::find_first_of_case(normalized_path, it.first) == 0) { // Found symlink, fixup by replacing the prefix. full_path = it.second + full_path.substr(it.first.size()); break;