diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs index 41cff7a8ce..6e18018bb8 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.IO; using System.Linq; namespace Microsoft.Plugin.Folder.Sources @@ -78,6 +79,17 @@ namespace Microsoft.Plugin.Folder.Sources public static string Expand(string search) { + if (search == null) + { + throw new ArgumentNullException(nameof(search)); + } + + // Absolute path of system drive: \Windows\System32 + if (search[0] == '\\' && (search.Length == 1 || search[1] != '\\')) + { + search = Path.Combine(Path.GetPathRoot(Environment.SystemDirectory), search.Substring(1)); + } + return Environment.ExpandEnvironmentVariables(search); } }