Skip to content

Commit f3f9d62

Browse files
CopilotJack251970
andcommitted
Recreate NeedDelete.txt marker when directory deletion is incomplete
Co-authored-by: Jack251970 <[email protected]>
1 parent 0de552f commit f3f9d62

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Flow.Launcher.Core/Plugin/PluginConfig.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,20 @@ public static List<PluginMetadata> Parse(string[] pluginDirectories)
3434
var fullyDeleted = FilesFolders.TryDeleteDirectoryRobust(directory, maxRetries: 3, retryDelayMs: 100);
3535
if (!fullyDeleted)
3636
{
37-
PublicApi.Instance.LogWarn(ClassName, $"Directory <{directory}> was not fully deleted. Some files or folders may still remain.");
37+
// Directory was not fully deleted, recreate the marker file so deletion will be retried on next startup
38+
try
39+
{
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
49+
}
50+
PublicApi.Instance.LogWarn(ClassName, $"Directory <{directory}> was not fully deleted. Some files or folders may still remain. Deletion will be retried on next startup.");
3851
}
3952
}
4053
catch (Exception e)

0 commit comments

Comments
 (0)