Create user map directory if it doesn't exist.

This commit is contained in:
Paul Chote
2017-07-20 21:52:18 +00:00
committed by abcdefg30
parent d8bc4905cb
commit d1ed0e09d0

View File

@@ -54,12 +54,21 @@ namespace OpenRA
? MapClassification.Unknown : Enum<MapClassification>.Parse(kv.Value);
IReadOnlyPackage package;
var optional = name.StartsWith("~");
var optional = name.StartsWith("~", StringComparison.Ordinal);
if (optional)
name = name.Substring(1);
try
{
// HACK: If the path is inside the the support directory then we may need to create it
if (name.StartsWith("^", StringComparison.Ordinal))
{
// Assume that the path is a directory if there is not an existing file with the same name
var resolved = Platform.ResolvePath(name);
if (!File.Exists(resolved))
Directory.CreateDirectory(resolved);
}
package = modData.ModFiles.OpenPackage(name);
}
catch