Don't save in system pathes because UNIX needs root and shipped maps
should not be changed. Use $HOME/maps/$MOD instead.
This commit is contained in:
Matthias Mailänder
2012-12-03 11:39:25 +01:00
committed by Chris Forbes
parent 107c37f33d
commit 7d4399d7cc

View File

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