Expand ~ to $home on Windows with tab completion (#21529) (#23934)

This commit is contained in:
Aditya Patwardhan
2024-06-11 16:16:32 -07:00
committed by GitHub
parent 1e13b5247e
commit a0bf209924
2 changed files with 9 additions and 2 deletions
@@ -4892,12 +4892,15 @@ namespace System.Management.Automation
for (int i = 0; i < path.Length; i++)
{
// on Windows, we need to preserve the expanded home path as native commands don't understand it
#if UNIX
if (i == homeIndex)
{
_ = sb.Append('~');
i += homePath.Length - 1;
continue;
}
#endif
EscapeCharIfNeeded(sb, path, i, stringType, literalPath, useSingleQuoteEscapeRules, ref quotesAreNeeded);
_ = sb.Append(path[i]);