fix short path processing

This commit is contained in:
Steve Lee (POWERSHELL) 2019-04-01 12:05:45 -07:00
parent 11f93c5a2b
commit 586084fb6b

View file

@ -129,7 +129,7 @@ namespace Microsoft.PowerShell.Commands
foreach (string item in path.Split(StringLiterals.DefaultPathSeparator))
{
if (itemsToSkip-- > 0 || item.Contains('~'))
if (itemsToSkip-- > 0)
{
// This handles the UNC server and share and 8.3 short path syntax
exactPath += item + StringLiterals.DefaultPathSeparator;
@ -145,6 +145,11 @@ namespace Microsoft.PowerShell.Commands
// This handles the trailing slash case
continue;
}
else if (item.Contains('~'))
{
// This handles short path names
exactPath += StringLiterals.DefaultPathSeparator + item;
}
else
{
exactPath = Directory.GetFileSystemEntries(exactPath, item).First();