mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
[PT Run] Folder path starting with backslash (#7711)
* folder plugin path starting with backslash * handle single \ input
This commit is contained in:
parent
ccf02579e6
commit
6e8337c563
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user