Skip to content

Should we do path normalizations on Unix well as on Windows? #6833

@iSazonov

Description

@iSazonov

Currently we do agressively path normalizations by replacing '/' with '\' on Windows and '\' with '/' on Unix. NormalizePath()
It is acceptable for Windows but has side affects on Unix because '\' is valid char in directory/file names.

.Net Core do the same for Windows but don't the normalization for Unix.
IsPathRooted on Unix (IsDirectorySeparator)
IsPathRooted on Windows (IsDirectorySeparator)

NormalizeDirectorySeparators on Unix
NormalizeDirectorySeparators on Windows

As you see Unix takes into account only '/' and Windows both '\' and '/'.

Should we follow .Net Core in the path normalization?

Related issues:

Simple side affect repo on Unix below:

Steps to reproduce

mkdir /\

cd \
$pwd

Expected behavior

\

Actual behavior

/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Committee-ReviewedPS-Committee has reviewed this and made a decisionIssue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-DuplicateThe issue is a duplicate.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions