Fix inability to delete unpacked maps

This commit is contained in:
Oliver Brakmann
2015-05-24 14:32:46 +02:00
parent 88d448bf40
commit 331ad217c2

View File

@@ -273,7 +273,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var path = Game.ModData.MapCache[map].Map.Path; var path = Game.ModData.MapCache[map].Map.Path;
try try
{ {
if (File.Exists(path))
File.Delete(path); File.Delete(path);
else if (Directory.Exists(path))
Directory.Delete(path, true);
Game.ModData.MapCache[map].Invalidate(); Game.ModData.MapCache[map].Invalidate();
if (selectedUid == map) if (selectedUid == map)
@@ -281,7 +285,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
} }
catch (Exception ex) catch (Exception ex)
{ {
Game.Debug("Failed to delete map file '{0}'. See the logs for details.", path); Game.Debug("Failed to delete map '{0}'. See the debug.log file for details.", path);
Log.Write("debug", ex.ToString()); Log.Write("debug", ex.ToString());
} }