Skip to content

Commit 37837e7

Browse files
committed
Fix possible exception when deleting local folder
1 parent f0e74a2 commit 37837e7

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,15 @@ internal static void InstallPlugin(UserPlugin plugin, string zipFilePath, bool c
521521

522522
FilesFolders.CopyAll(pluginFolderPath, newPluginPath, MessageBoxEx.Show);
523523

524-
Directory.Delete(tempFolderPluginPath, true);
524+
try
525+
{
526+
if (Directory.Exists(tempFolderPluginPath))
527+
Directory.Delete(tempFolderPluginPath, true);
528+
}
529+
catch (Exception e)
530+
{
531+
Log.Exception($"|PluginManager.InstallPlugin|Failed to delete temp folder {tempFolderPluginPath}", e);
532+
}
525533

526534
if (checkModified)
527535
{
@@ -557,7 +565,14 @@ internal static void UninstallPlugin(PluginMetadata plugin, bool removePluginFro
557565
if (pluginJsonStorage != null)
558566
{
559567
var deleteMethod = pluginJsonStorage.GetType().GetMethod("DeleteDirectory");
560-
deleteMethod?.Invoke(pluginJsonStorage, null);
568+
try
569+
{
570+
deleteMethod?.Invoke(pluginJsonStorage, null);
571+
}
572+
catch (Exception e)
573+
{
574+
Log.Exception($"|PluginManager.UninstallPlugin|Failed to delete plugin json folder for {assemblyName}", e);
575+
}
561576
}
562577
}
563578

0 commit comments

Comments
 (0)