Fix the alternate path separator for Linux
Because normalization of paths occurs through the location globber and filesystem provider by way of `path.Replace(alternate, default)`, changing the alternate path separator on Linux to be '\' instead of .NET's '/' let's PowerShell be "slash agnostic."
This commit is contained in:
parent
140cb4aece
commit
a8f93c3c64
@ -26,6 +26,9 @@ namespace System.Management.Automation
|
||||
|
||||
/// <summary>
|
||||
/// The default path separator used by the base implementation of the providers.
|
||||
///
|
||||
/// Porting note: IO.Path.DirectorySeparatorChar is correct for all platforms. On Windows,
|
||||
/// it is '\', and on Linux, it is '/', as expected.
|
||||
/// </summary>
|
||||
///
|
||||
internal static readonly char DefaultPathSeparator = System.IO.Path.DirectorySeparatorChar;
|
||||
@ -33,9 +36,14 @@ namespace System.Management.Automation
|
||||
|
||||
/// <summary>
|
||||
/// The alternate path separator used by the base implementation of the providers.
|
||||
///
|
||||
/// Porting note: we do not use .NET's AlternatePathSeparatorChar here because it correctly
|
||||
/// states that both the default and alternate are '/' on Linux. However, for PowerShell to
|
||||
/// be "slash agnostic", we need to use the assumption that a '\' is the alternate path
|
||||
/// separator on Linux.
|
||||
/// </summary>
|
||||
///
|
||||
internal static readonly char AlternatePathSeparator = System.IO.Path.AltDirectorySeparatorChar;
|
||||
internal static readonly char AlternatePathSeparator = Platform.IsWindows ? '/' : '\\';
|
||||
internal static readonly string AlternatePathSeparatorString = AlternatePathSeparator.ToString();
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user