diff --git a/OpenRA.Editor/MapSelect.cs b/OpenRA.Editor/MapSelect.cs index 17744a2283..14efb9272c 100644 --- a/OpenRA.Editor/MapSelect.cs +++ b/OpenRA.Editor/MapSelect.cs @@ -20,11 +20,19 @@ namespace OpenRA.Editor { public string MapFolderPath; + public bool DirectoryIsEmpty(string path) + { + return !Directory.GetFileSystemEntries(path).Any(); + } + public MapSelect(string currentMod) { - MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" } + MapFolderPath = new string[] { Platform.SupportDir, "maps", currentMod } .Aggregate(Path.Combine); + if (!Directory.Exists(MapFolderPath)) + Directory.CreateDirectory(MapFolderPath); + InitializeComponent(); MapIconsList.Images.Add(pictureBox1.Image); } @@ -34,6 +42,9 @@ namespace OpenRA.Editor MapList.Items.Clear(); txtPathOut.Text = MapFolderPath; + if (DirectoryIsEmpty(MapFolderPath)) + return; + foreach (var map in ModData.FindMapsIn(MapFolderPath)) { ListViewItem map1 = new ListViewItem();