mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Filter common parent for PATH and custom sources
This commit is contained in:
parent
e69926ec44
commit
fed130b0ce
1 changed files with 5 additions and 3 deletions
|
|
@ -414,7 +414,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
return programs;
|
||||
}
|
||||
|
||||
private static IEnumerable<Win32> PATHPrograms(string[] suffixes, string[] protocols)
|
||||
private static IEnumerable<Win32> PATHPrograms(string[] suffixes, string[] protocols, List<string> commonParents)
|
||||
{
|
||||
var pathEnv = Environment.GetEnvironmentVariable("Path");
|
||||
if (String.IsNullOrEmpty(pathEnv))
|
||||
|
|
@ -424,6 +424,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
var paths = pathEnv.Split(";", StringSplitOptions.RemoveEmptyEntries).DistinctBy(p => p.ToLowerInvariant());
|
||||
|
||||
paths = paths.Where(x => commonParents.All(parent => !x.StartsWith(parent, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
var toFilter = paths.AsParallel().SelectMany(p => EnmuerateProgramsInDir(p, suffixes, recursive: false));
|
||||
|
||||
var programs = ExceptDisabledSource(toFilter.Distinct())
|
||||
|
|
@ -592,8 +594,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
if (settings.EnablePATHSource)
|
||||
{
|
||||
var path = PATHPrograms(settings.GetSuffixes(), protocols);
|
||||
autoIndexPrograms = autoIndexPrograms.Concat(path);
|
||||
var path = PATHPrograms(settings.GetSuffixes(), protocols, commonParents);
|
||||
programs = programs.Concat(path);
|
||||
}
|
||||
|
||||
autoIndexPrograms = ProgramsHasher(autoIndexPrograms).ToArray();
|
||||
|
|
|
|||
Loading…
Reference in a new issue