Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions Knossos.NET/Classes/Knossos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Knossos.NET.Models;
using Knossos.NET.ViewModels;
using Knossos.NET.Views;
using Microsoft.VisualBasic.FileIO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Threading.Tasks;
Expand Down Expand Up @@ -1660,7 +1661,16 @@ public static void RemoveMod(string modId)
foreach (var mod in delete)
{
Log.Add(Log.LogSeverity.Information, "Knossos.RemoveMod()", "Deleting mod: "+mod.title + " " +mod.version);
Directory.Delete(mod.fullPath, true);
try
{
// this might only work on Windows
FileSystem.DeleteDirectory(mod.fullPath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
}
catch (PlatformNotSupportedException)
{
// this should work on all platforms but doesn't use the Recycle Bin / Trash
Directory.Delete(mod.fullPath, true);
}
installedMods.Remove(mod);
}
}
Expand All @@ -1682,7 +1692,16 @@ public static void RemoveMod(Mod mod)
try
{
Log.Add(Log.LogSeverity.Information, "Knossos.RemoveMod()", "Deleting mod: " + mod.title + " " + mod.version);
Directory.Delete(mod.fullPath, true);
try
{
// this might only work on Windows
FileSystem.DeleteDirectory(mod.fullPath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
}
catch (PlatformNotSupportedException)
{
// this should work on all platforms but doesn't use the Recycle Bin / Trash
Directory.Delete(mod.fullPath, true);
}
installedMods.Remove(mod);
}
catch (Exception ex)
Expand Down