Create SupportDirPrefix and IsPathRelativeToSupportDirectory() as members on Platform class.

This commit is contained in:
Peter Antal
2018-03-04 22:04:39 -08:00
committed by Paul Chote
parent 1f4573886b
commit 3ce2417a06
7 changed files with 16 additions and 10 deletions

View File

@@ -70,7 +70,7 @@ namespace OpenRA
try
{
// HACK: If the path is inside the the support directory then we may need to create it
if (name.StartsWith("^", StringComparison.Ordinal))
if (Platform.IsPathRelativeToSupportDirectory(name))
{
// Assume that the path is a directory if there is not an existing file with the same name
var resolved = Platform.ResolvePath(name);
@@ -144,7 +144,7 @@ namespace OpenRA
name = name.Substring(1);
// Don't try to open the map directory in the support directory if it doesn't exist
if (name.StartsWith("^", StringComparison.Ordinal))
if (Platform.IsPathRelativeToSupportDirectory(name))
{
var resolved = Platform.ResolvePath(name);
if (!Directory.Exists(resolved) || !File.Exists(resolved))