Skip to content

Commit 7b3216b

Browse files
committed
Simplify marker file recreation logic on plugin deletion
Refactored the process for recreating the marker file when a plugin directory is not fully deleted. Removed unnecessary try-catch and nested checks, now directly checking for file existence and creating it if missing. This streamlines the code and removes redundant error handling.
1 parent f3f9d62 commit 7b3216b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Flow.Launcher.Core/Plugin/PluginConfig.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,10 @@ public static List<PluginMetadata> Parse(string[] pluginDirectories)
3535
if (!fullyDeleted)
3636
{
3737
// Directory was not fully deleted, recreate the marker file so deletion will be retried on next startup
38-
try
38+
var markerFilePath = Path.Combine(directory, DataLocation.PluginDeleteFile);
39+
if (!File.Exists(markerFilePath))
3940
{
40-
var markerFilePath = Path.Combine(directory, DataLocation.PluginDeleteFile);
41-
if (!File.Exists(markerFilePath))
42-
{
43-
File.WriteAllText(markerFilePath, string.Empty);
44-
}
45-
}
46-
catch
47-
{
48-
// If we can't create the marker file, at least log the warning
41+
File.WriteAllText(markerFilePath, string.Empty);
4942
}
5043
PublicApi.Instance.LogWarn(ClassName, $"Directory <{directory}> was not fully deleted. Some files or folders may still remain. Deletion will be retried on next startup.");
5144
}

0 commit comments

Comments
 (0)