fix environment variable search to be case insensitive

This commit is contained in:
Jeremy Wu 2020-06-29 19:56:28 +10:00
parent cbefd4e511
commit 5ff278230b

View file

@ -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<string, string> LoadEnvironmentStringPaths()
{
var envStringPaths = new Dictionary<string, string>();
var envStringPaths = new Dictionary<string, string>(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;
}
}