From 5ff278230b6ab51bb09e24dc76bdac2146db8327 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 29 Jun 2020 19:56:28 +1000 Subject: [PATCH] fix environment variable search to be case insensitive --- .../Search/EnvironmentVariables.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs index 977b9423e..2dec51e99 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -18,12 +18,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search internal static Dictionary LoadEnvironmentStringPaths() { - var envStringPaths = new Dictionary(); + var envStringPaths = new Dictionary(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry special in Environment.GetEnvironmentVariables()) { if (Directory.Exists(special.Value.ToString())) { + // Variables are returned with a mixture of all upper/lower case. + // Call ToLower() to make them look consitent envStringPaths.Add(special.Key.ToString().ToLower(), special.Value.ToString()); } } @@ -82,11 +84,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search foreach (var p in environmentVariables) { - if (p.Key.StartsWith(search)) + if (p.Key.StartsWith(search, StringComparison.InvariantCultureIgnoreCase)) { results.Add(new ResultManager(context).CreateFolderResult($"%{p.Key}%", p.Value, p.Value, query)); } } + return results; } }