From 520502dab078be50e4e590aade3cb898ac6d970d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 2 Nov 2025 22:40:39 +1000 Subject: [PATCH] FileSystem: Fix RealPath() with relative paths --- src/common/file_system.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp index c277d242c..b16db60df 100644 --- a/src/common/file_system.cpp +++ b/src/common/file_system.cpp @@ -323,11 +323,15 @@ bool Path::IsAbsolute(std::string_view path) std::string Path::RealPath(std::string_view path) { // Resolve non-absolute paths first. + std::string abs_path; std::vector components; if (!IsAbsolute(path)) - components = Path::SplitNativePath(Path::Combine(FileSystem::GetWorkingDirectory(), path)); - else - components = Path::SplitNativePath(path); + { + abs_path = Path::Combine(FileSystem::GetWorkingDirectory(), path); + path = abs_path; + } + + components = Path::SplitNativePath(path); std::string realpath; if (components.empty())