Skip to content

Commit 5ff2782

Browse files
committed
fix environment variable search to be case insensitive
1 parent cbefd4e commit 5ff2782

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.IO;
@@ -18,12 +18,14 @@ internal static bool IsEnvironmentVariableSearch(string search)
1818

1919
internal static Dictionary<string, string> LoadEnvironmentStringPaths()
2020
{
21-
var envStringPaths = new Dictionary<string, string>();
21+
var envStringPaths = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
2222

2323
foreach (DictionaryEntry special in Environment.GetEnvironmentVariables())
2424
{
2525
if (Directory.Exists(special.Value.ToString()))
2626
{
27+
// Variables are returned with a mixture of all upper/lower case.
28+
// Call ToLower() to make them look consitent
2729
envStringPaths.Add(special.Key.ToString().ToLower(), special.Value.ToString());
2830
}
2931
}
@@ -82,11 +84,12 @@ internal static List<Result> GetEnvironmentStringPathSuggestions(string querySea
8284

8385
foreach (var p in environmentVariables)
8486
{
85-
if (p.Key.StartsWith(search))
87+
if (p.Key.StartsWith(search, StringComparison.InvariantCultureIgnoreCase))
8688
{
8789
results.Add(new ResultManager(context).CreateFolderResult($"%{p.Key}%", p.Value, p.Value, query));
8890
}
8991
}
92+
9093
return results;
9194
}
9295
}

0 commit comments

Comments
 (0)