Remove Platform.UnresolvePath.
This commit is contained in:
@@ -201,26 +201,5 @@ namespace OpenRA
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace the full path prefix with the special notation characters ^ or .
|
||||
/// and transforms \ path separators to / on Windows
|
||||
/// </summary>
|
||||
public static string UnresolvePath(string path)
|
||||
{
|
||||
// Use a case insensitive comparison on windows to avoid problems
|
||||
// with inconsistent drive letter case
|
||||
var compare = CurrentPlatform == PlatformType.Windows ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
|
||||
if (path.StartsWith(SupportDir, compare))
|
||||
path = "^" + path.Substring(SupportDir.Length);
|
||||
|
||||
if (path.StartsWith(GameDir, compare))
|
||||
path = "./" + path.Substring(GameDir.Length);
|
||||
|
||||
if (CurrentPlatform == PlatformType.Windows)
|
||||
path = path.Replace('\\', '/');
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
modData.ModFiles.TryGetPackageContaining(filename, out var package, out var name);
|
||||
name = package.Name + "/" + name;
|
||||
Console.WriteLine("# {0}:", Platform.UnresolvePath(name));
|
||||
Console.WriteLine("# {0}:", filename);
|
||||
|
||||
var yaml = MiniYaml.FromFile(name, false);
|
||||
FromChromeLayout(ref yaml, null,
|
||||
|
||||
@@ -45,18 +45,5 @@ namespace OpenRA.Test
|
||||
Assert.That(Platform.ResolvePath("testpath"),
|
||||
Is.EqualTo("testpath"));
|
||||
}
|
||||
|
||||
[TestCase(TestName = "Returns encoded paths")]
|
||||
public void UnresolvePath()
|
||||
{
|
||||
Assert.That(Platform.UnresolvePath(Path.Combine(supportDir, "testpath")),
|
||||
Is.EqualTo("^testpath"));
|
||||
|
||||
Assert.That(Platform.UnresolvePath(Path.Combine(gameDir, "testpath")),
|
||||
Is.EqualTo("./testpath"));
|
||||
|
||||
Assert.That(Platform.UnresolvePath("testpath"),
|
||||
Is.EqualTo("testpath"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user