[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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.Plugin.Folder.Sources
|
namespace Microsoft.Plugin.Folder.Sources
|
||||||
|
@ -78,6 +79,17 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||||
|
|
||||||
public static string Expand(string search)
|
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);
|
return Environment.ExpandEnvironmentVariables(search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue