FileSystem: Improve handling of relative paths in RealPath()

This commit is contained in:
TheLastRar 2025-03-04 19:36:42 +00:00 committed by Ty
parent 06be543d32
commit e3c988aa8b
1 changed files with 7 additions and 1 deletions

View File

@ -288,8 +288,14 @@ std::string Path::RealPath(const std::string_view path)
{
// Resolve non-absolute paths first.
std::vector<std::string_view> components;
// We need to keep the full combined path in scope
// as SplitNativePath() returns string_views to it.
std::string buf;
if (!IsAbsolute(path))
components = Path::SplitNativePath(Path::Combine(FileSystem::GetWorkingDirectory(), path));
{
buf = Path::Combine(FileSystem::GetWorkingDirectory(), path);
components = Path::SplitNativePath(buf);
}
else
components = Path::SplitNativePath(path);