dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.07k stars 4.69k forks source link

Agnostic URI/path #28263

Open vbjay opened 5 years ago

vbjay commented 5 years ago

Related: dotnet/runtime#14590

.Net needs a way to represent a path that isn't a string but a struct or class. I am working on the GitExtensions project. Git returns linux paths. Creating a System.URI instance with a path like/d/git/GitExtensions/ fails on Windows. I have found a few projects that try to manage paths.

Being able to store a normalized path in our variables that can be translated to URIs or posix or... would be very helpful. All of the following paths should be stored in a normalized posix format that can then be used in any path usage.

c:\git\project 1\file
c:\git/project 1/file
/c/git/project 1/file
\\server\share\folder 1\file

I was hoping I could use System.URI as the backing store of the path objects but linux paths are a no go so I am looking into other solutions.

danmoseley commented 5 years ago

@jeremykuhne

vbjay commented 5 years ago

Another point, when checking equality the first 3 paths should be equal.

vbjay commented 5 years ago

Also making this work in .net standard so the full framework also exhibits the same behaviour would be great.

ctigrisht commented 10 months ago

please fix this it's been a long time