start reworking map enumerator
This commit is contained in:
@@ -43,11 +43,21 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Do this nicer
|
// TODO: Do this nicer
|
||||||
|
IEnumerable<string> FindMapsIn(string dir)
|
||||||
|
{
|
||||||
|
string[] NoMaps = { };
|
||||||
|
|
||||||
|
if (!Directory.Exists(dir))
|
||||||
|
return NoMaps;
|
||||||
|
|
||||||
|
// todo: look for compressed maps too.
|
||||||
|
return Directory.GetDirectories(dir);
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, MapStub> FindMaps(string[] mods)
|
Dictionary<string, MapStub> FindMaps(string[] mods)
|
||||||
{
|
{
|
||||||
var paths = new[] { "maps/" }.Concat(mods.Select(m => "mods/" + m + "/maps/"))
|
var paths = new[] { "maps/" }.Concat(mods.Select(m => "mods/" + m + "/maps/"))
|
||||||
.Where(p => Directory.Exists(p))
|
.SelectMany(p => FindMapsIn(p));
|
||||||
.SelectMany(p => Directory.GetDirectories(p)).ToList();
|
|
||||||
|
|
||||||
return paths.Select(p => new MapStub(new Folder(p, int.MaxValue))).ToDictionary(m => m.Uid);
|
return paths.Select(p => new MapStub(new Folder(p, int.MaxValue))).ToDictionary(m => m.Uid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user