From e5f82eb0d942a010ca5d08824071a42baa497486 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 17 Nov 2022 16:55:53 +0800 Subject: [PATCH] Revert "non-recursive monitor for custom source" This reverts commit 0e18c08798dcc389362c6b567f06eb7734ddb07a. --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 2 +- .../Flow.Launcher.Plugin.Program/Programs/Win32.cs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index feeb8e78a..c212bf8f4 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -102,7 +102,7 @@ namespace Flow.Launcher.Plugin.Program await Task.WhenAll(a, b); Win32.WatchProgramUpdate(_settings); - _ = UWP.WatchPackageChange(); + UWP.WatchPackageChange(); } public static void IndexWin32Programs() diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 51959143c..61dc146a8 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -396,8 +396,7 @@ namespace Flow.Launcher.Plugin.Program.Programs .SelectMany(s => EnmuerateProgramsInDir(s, suffixes)); // Remove disabled programs in DisabledProgramSources - var programs = ExceptDisabledSource(paths) - .Select(x => GetProgramFromPath(x, protocols)); + var programs = ExceptDisabledSource(paths).Select(x => GetProgramFromPath(x, protocols)); return programs; } @@ -661,16 +660,13 @@ namespace Flow.Launcher.Plugin.Program.Programs if (settings.EnableStartMenuSource) paths.AddRange(GetStartMenuPaths()); + paths.AddRange(from source in settings.ProgramSources where source.Enabled select source.Location); + foreach (var directory in from path in paths where Directory.Exists(path) select path) { WatchDirectory(directory); } - foreach (var directory in from source in settings.ProgramSources where Directory.Exists(source.Location) select source.Location) - { - WatchDirectory(directory, false); - } - _ = Task.Run(MonitorDirectoryChangeAsync); } @@ -689,7 +685,7 @@ namespace Flow.Launcher.Plugin.Program.Programs } } - public static void WatchDirectory(string directory, bool recursive = true) + public static void WatchDirectory(string directory) { if (!Directory.Exists(directory)) { @@ -700,7 +696,7 @@ namespace Flow.Launcher.Plugin.Program.Programs watcher.Created += static (_, _) => indexQueue.Writer.TryWrite(default); watcher.Deleted += static (_, _) => indexQueue.Writer.TryWrite(default); watcher.EnableRaisingEvents = true; - watcher.IncludeSubdirectories = recursive; + watcher.IncludeSubdirectories = true; Watchers.Add(watcher); }