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())