diff --git a/Source/Engine/Platform/Base/StringUtilsBase.cpp b/Source/Engine/Platform/Base/StringUtilsBase.cpp index ce895bfa4..c18d309a5 100644 --- a/Source/Engine/Platform/Base/StringUtilsBase.cpp +++ b/Source/Engine/Platform/Base/StringUtilsBase.cpp @@ -337,18 +337,23 @@ void StringUtils::PathRemoveRelativeParts(String& path) path.Split(TEXT('/'), components); Array> stack; - for (auto& bit : components) + for (String& bit : components) { if (bit == TEXT("..")) { if (stack.HasItems()) { - auto popped = stack.Pop(); + String popped = stack.Pop(); + const int32 windowsDriveStart = popped.Find('\\'); if (popped == TEXT("..")) { stack.Push(popped); stack.Push(bit); } + else if (windowsDriveStart != -1) + { + stack.Add(MoveTemp(popped.Left(windowsDriveStart + 1))); + } } else { @@ -361,13 +366,13 @@ void StringUtils::PathRemoveRelativeParts(String& path) } else { - stack.Push(bit); + stack.Add(MoveTemp(bit)); } } const bool isRooted = path.StartsWith(TEXT('/')) || (path.Length() >= 2 && path[0] == '.' && path[1] == '/'); path.Clear(); - for (auto& e : stack) + for (const String& e : stack) path /= e; if (isRooted && path.HasChars() && path[0] != '/') path.Insert(0, TEXT("/")); diff --git a/Source/Tools/Flax.Build/Utilities/Utilities.cs b/Source/Tools/Flax.Build/Utilities/Utilities.cs index a81072cff..af6777199 100644 --- a/Source/Tools/Flax.Build/Utilities/Utilities.cs +++ b/Source/Tools/Flax.Build/Utilities/Utilities.cs @@ -631,11 +631,16 @@ namespace Flax.Build if (stack.Count != 0) { var popped = stack.Pop(); + var windowsDriveStart = popped.IndexOf('\\'); if (popped == "..") { stack.Push(popped); stack.Push(bit); } + else if (windowsDriveStart != -1) + { + stack.Push(popped.Substring(windowsDriveStart + 1)); + } } else {