From 7d4399d7cc906ac291f78e338ba55b83f5f64c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 3 Dec 2012 11:39:25 +0100 Subject: [PATCH] fixes #2481 Don't save in system pathes because UNIX needs root and shipped maps should not be changed. Use $HOME/maps/$MOD instead. --- OpenRA.Editor/MapSelect.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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();