Skip to content

Commit 31501a1

Browse files
committed
Load environment variables from system
1 parent a66b4cd commit 31501a1

File tree

1 file changed

+7
-17
lines changed
  • Plugins/Flow.Launcher.Plugin.Folder

1 file changed

+7
-17
lines changed

Plugins/Flow.Launcher.Plugin.Folder/Main.cs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,15 @@ private void InitialDriverList()
166166
private void LoadEnvironmentStringPaths()
167167
{
168168
_envStringPaths = new Dictionary<string, string>();
169-
170-
var specialPaths =
171-
new Dictionary<string,Environment.SpecialFolder> {
172-
{ "appdata", Environment.SpecialFolder.ApplicationData },
173-
{ "localappdata", Environment.SpecialFolder.LocalApplicationData },
174-
{ "programfiles", Environment.SpecialFolder.ProgramFiles },
175-
{ "programfiles(x86)", Environment.SpecialFolder.ProgramFilesX86 },
176-
{ "programdata", Environment.SpecialFolder.CommonApplicationData },
177-
{ "userprofile", Environment.SpecialFolder.UserProfile }
178-
};
179-
180-
foreach (var special in specialPaths)
169+
170+
var specialPaths = System.Environment.GetEnvironmentVariables();
171+
foreach (DictionaryEntry special in specialPaths)
181172
{
182-
_envStringPaths.Add(special.Key, Environment.GetFolderPath(special.Value));
173+
if (Directory.Exists(special.Value.ToString()))
174+
{
175+
_envStringPaths.Add(special.Key.ToString().ToLower(), special.Value.ToString());
176+
}
183177
}
184-
185-
var tempDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Temp");
186-
187-
_envStringPaths.Add("temp", tempDirectoryPath);
188178
}
189179

190180
private static readonly char[] _specialSearchChars = new char[]

0 commit comments

Comments
 (0)