Skip to content

Commit e5f82eb

Browse files
Revert "non-recursive monitor for custom source"
This reverts commit 0e18c08.
1 parent 0e18c08 commit e5f82eb

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public async Task InitAsync(PluginInitContext context)
102102
await Task.WhenAll(a, b);
103103

104104
Win32.WatchProgramUpdate(_settings);
105-
_ = UWP.WatchPackageChange();
105+
UWP.WatchPackageChange();
106106
}
107107

108108
public static void IndexWin32Programs()

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ private static IEnumerable<Win32> UnregisteredPrograms(List<string> directories,
396396
.SelectMany(s => EnmuerateProgramsInDir(s, suffixes));
397397

398398
// Remove disabled programs in DisabledProgramSources
399-
var programs = ExceptDisabledSource(paths)
400-
.Select(x => GetProgramFromPath(x, protocols));
399+
var programs = ExceptDisabledSource(paths).Select(x => GetProgramFromPath(x, protocols));
401400
return programs;
402401
}
403402

@@ -661,16 +660,13 @@ public static void WatchProgramUpdate(Settings settings)
661660
if (settings.EnableStartMenuSource)
662661
paths.AddRange(GetStartMenuPaths());
663662

663+
paths.AddRange(from source in settings.ProgramSources where source.Enabled select source.Location);
664+
664665
foreach (var directory in from path in paths where Directory.Exists(path) select path)
665666
{
666667
WatchDirectory(directory);
667668
}
668669

669-
foreach (var directory in from source in settings.ProgramSources where Directory.Exists(source.Location) select source.Location)
670-
{
671-
WatchDirectory(directory, false);
672-
}
673-
674670
_ = Task.Run(MonitorDirectoryChangeAsync);
675671
}
676672

@@ -689,7 +685,7 @@ public static async Task MonitorDirectoryChangeAsync()
689685
}
690686
}
691687

692-
public static void WatchDirectory(string directory, bool recursive = true)
688+
public static void WatchDirectory(string directory)
693689
{
694690
if (!Directory.Exists(directory))
695691
{
@@ -700,7 +696,7 @@ public static void WatchDirectory(string directory, bool recursive = true)
700696
watcher.Created += static (_, _) => indexQueue.Writer.TryWrite(default);
701697
watcher.Deleted += static (_, _) => indexQueue.Writer.TryWrite(default);
702698
watcher.EnableRaisingEvents = true;
703-
watcher.IncludeSubdirectories = recursive;
699+
watcher.IncludeSubdirectories = true;
704700

705701
Watchers.Add(watcher);
706702
}

0 commit comments

Comments
 (0)