PT Run tile as user home (#9579)

This commit is contained in:
Davide Giacometti
2021-02-10 14:02:29 +01:00
committed by GitHub
parent 6793f74b3b
commit d2902440d2

View File

@@ -84,11 +84,17 @@ namespace Microsoft.Plugin.Folder.Sources
throw new ArgumentNullException(nameof(search));
}
// Absolute path of system drive: \Windows\System32
if (search[0] == '\\' && (search.Length == 1 || search[1] != '\\'))
{
// Absolute path of system drive: \Windows\System32
search = Path.Combine(Path.GetPathRoot(Environment.SystemDirectory), search.Substring(1));
}
else if (search[0] == '~')
{
// User home
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
search = search.Length > 1 ? Path.Combine(home, search.Substring(2)) : home;
}
return Environment.ExpandEnvironmentVariables(search);
}