catch map load failures
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -105,14 +106,19 @@ namespace OpenRA
|
|||||||
var paths = mods.SelectMany(p => FindMapsIn("mods{0}{1}{0}maps{0}".F(Path.DirectorySeparatorChar, p)))
|
var paths = mods.SelectMany(p => FindMapsIn("mods{0}{1}{0}maps{0}".F(Path.DirectorySeparatorChar, p)))
|
||||||
.Concat(mods.SelectMany(p => FindMapsIn("{1}maps{0}{2}{0}".F(Path.DirectorySeparatorChar, Platform.SupportDir, p))));
|
.Concat(mods.SelectMany(p => FindMapsIn("{1}maps{0}{2}{0}".F(Path.DirectorySeparatorChar, Platform.SupportDir, p))));
|
||||||
|
|
||||||
Dictionary<string, Map> ret = new Dictionary<string, Map>();
|
var ret = new Dictionary<string, Map>();
|
||||||
foreach (var path in paths)
|
foreach (var path in paths)
|
||||||
{
|
{
|
||||||
var map = new Map(path);
|
try
|
||||||
if (ret.ContainsKey(map.Uid))
|
{
|
||||||
System.Console.WriteLine("Ignoring duplicate map: {0}", path);
|
var map = new Map(path);
|
||||||
else
|
|
||||||
ret.Add(map.Uid, map);
|
ret.Add(map.Uid, map);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Failed to load map: {0}", path);
|
||||||
|
Console.WriteLine("Details: {0}", e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user