Revert "non-recursive monitor for custom source"

This reverts commit 0e18c08798.
This commit is contained in:
Vic 2022-11-17 16:55:53 +08:00
parent 0e18c08798
commit e5f82eb0d9
2 changed files with 6 additions and 10 deletions

View file

@ -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()

View file

@ -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);
}