Create user map directory if it doesn't exist.
This commit is contained in:
@@ -54,12 +54,21 @@ namespace OpenRA
|
|||||||
? MapClassification.Unknown : Enum<MapClassification>.Parse(kv.Value);
|
? MapClassification.Unknown : Enum<MapClassification>.Parse(kv.Value);
|
||||||
|
|
||||||
IReadOnlyPackage package;
|
IReadOnlyPackage package;
|
||||||
var optional = name.StartsWith("~");
|
var optional = name.StartsWith("~", StringComparison.Ordinal);
|
||||||
if (optional)
|
if (optional)
|
||||||
name = name.Substring(1);
|
name = name.Substring(1);
|
||||||
|
|
||||||
try
|
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);
|
package = modData.ModFiles.OpenPackage(name);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
Reference in New Issue
Block a user