From 71a2f996dbff2c92b219aa5641af01ef50870622 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Fri, 20 Jan 2023 15:27:19 +0800 Subject: [PATCH] Set environment var dict in LoadEnvironmentStringPaths() --- .../Search/EnvironmentVariables.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs index 5b0a5a8bd..e526fb85a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/EnvironmentVariables.cs @@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search { if (_envStringPaths == null) { - _envStringPaths = LoadEnvironmentStringPaths(); + LoadEnvironmentStringPaths(); } return _envStringPaths; } @@ -40,9 +40,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search dir.Split('%').Length == 3); } - internal static Dictionary LoadEnvironmentStringPaths() + private static void LoadEnvironmentStringPaths() { - var envStringPaths = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + _envStringPaths = new Dictionary(StringComparer.InvariantCultureIgnoreCase); var homedrive = Environment.GetEnvironmentVariable("HOMEDRIVE")?.EnsureTrailingSlash() ?? "C:\\"; foreach (DictionaryEntry special in Environment.GetEnvironmentVariables()) @@ -61,11 +61,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search { // Variables are returned with a mixture of all upper/lower case. // Call ToUpper() to make the results look consistent - envStringPaths.Add(special.Key.ToString().ToUpper(), path); + _envStringPaths.Add(special.Key.ToString().ToUpper(), path); } } - - return envStringPaths; } internal static List GetEnvironmentStringPathSuggestions(string querySearch, Query query, PluginInitContext context)