FileSystem: Fix RealPath() with relative paths

This commit is contained in:
Stenzek committed 2025-11-02 22:40:39 +10:00
1 parent f5fc2474a4
commit 520502dab0
1 file changed
+7 -3
+7 -3
View File
@@ -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<std::string_view> 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())