From 331ad217c228cfc2fce70a70c8e54d1f95129be8 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 24 May 2015 14:32:46 +0200 Subject: [PATCH] Fix inability to delete unpacked maps --- OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index a9e7b1701a..175f0bbae5 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -273,7 +273,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic var path = Game.ModData.MapCache[map].Map.Path; try { - File.Delete(path); + if (File.Exists(path)) + File.Delete(path); + else if (Directory.Exists(path)) + Directory.Delete(path, true); + Game.ModData.MapCache[map].Invalidate(); if (selectedUid == map) @@ -281,7 +285,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } 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()); }