Fix PathRemoveRelativeParts for rooted paths
This commit is contained in:
@@ -261,7 +261,7 @@ void StringUtils::PathRemoveRelativeParts(String& path)
|
||||
path.Clear();
|
||||
for (auto& e : stack)
|
||||
path /= e;
|
||||
if (isRooted)
|
||||
if (isRooted && path[0] != '/')
|
||||
path.Insert(0, TEXT("/"));
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace FlaxEngine
|
||||
|
||||
bool isRooted = path.StartsWith("/");
|
||||
string result = string.Join(Path.DirectorySeparatorChar.ToString(), stack.Reverse());
|
||||
if (isRooted)
|
||||
if (isRooted && result[0] != '/')
|
||||
result = result.Insert(0, "/");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ namespace Flax.Build
|
||||
|
||||
bool isRooted = path.StartsWith("/");
|
||||
string result = string.Join(Path.DirectorySeparatorChar.ToString(), stack.Reverse());
|
||||
if (isRooted)
|
||||
if (isRooted && result[0] != '/')
|
||||
result = result.Insert(0, "/");
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user