Skip to content

Commit 6791579

Browse files
Use Linq
1 parent d5d141f commit 6791579

File tree

1 file changed

+3
-10
lines changed
  • Plugins/Flow.Launcher.Plugin.Program/Programs

1 file changed

+3
-10
lines changed

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ private static IEnumerable<Win32> UnregisteredPrograms(List<Settings.ProgramSour
361361

362362
private static IEnumerable<Win32> StartMenuPrograms(string[] suffixes)
363363
{
364-
var disabledProgramsList = Main._settings.DisabledProgramSources;
365364

366365
var directory1 = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
367366
var directory2 = Environment.GetFolderPath(Environment.SpecialFolder.CommonPrograms);
@@ -381,21 +380,15 @@ private static IEnumerable<Win32> StartMenuPrograms(string[] suffixes)
381380

382381
private static IEnumerable<Win32> PATHPrograms(string[] suffixes)
383382
{
384-
var disabledProgramsList = Main._settings.DisabledProgramSources;
385-
386-
string? pathEnv = Environment.GetEnvironmentVariable("Path");
383+
var pathEnv = Environment.GetEnvironmentVariable("Path");
387384
if (String.IsNullOrEmpty(pathEnv)) {
388385
return Array.Empty<Win32>();
389386
}
390387

391-
var toFilter = new List<string>();
392388
var paths = pathEnv.Split(";", StringSplitOptions.RemoveEmptyEntries).DistinctBy(p => p.ToLower());
393389

394-
foreach (var path in paths)
395-
{
396-
var p = ProgramPaths(path, suffixes, recursive:false);
397-
toFilter.AddRange(p);
398-
}
390+
var toFilter = paths.SelectMany(p => ProgramPaths(p, suffixes, recursive:false));
391+
399392
var programs = ExceptDisabledSource(toFilter.Distinct())
400393
.Select(x => Extension(x) switch
401394
{

0 commit comments

Comments
 (0)