-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetPathRoot of windows path on unix machine. #77352
Comments
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsHi all, The Problem we are experiencing: My Question/Suggestion: Example on how it is working on windows vs how it is working on unix: Thanks,
|
If it's just this API would pasting in the windows implementation into your code as your own version to use be sufficient? |
Yes, I thought about doing that as a solution for now. but wasn't sure if I am missing something and it is possible doing with your code as it is, but I guess not as it kind of missing the whole idea of cross Platform code, I guess. Thanks for the quick response :) |
Hi @bengabayAtM Thank you for creating the issue and providing clear requirements. Since you are not the first user asking for that and we have requests for other cross-platform Path functionality (#64890, #28263, #25011) I am going to re-open the issue to keep track of it. |
Hi all,
My name is Ben and I am working at Microsoft on MDE (Microsoft Defender for Endpoint).
we have a code that is using Path.GetPathRoot
The Problem we are experiencing:
We transfer our service that uses this function to Kubernetes and because it is running on ubuntu vm on Kubernetes we are failing
to use Path.GetPathRoot when passing a windows path. for example, we have this path "C:\mydir\myfile.ext"
and we want to get 'C:' as return value from Path.GetPathRoot.
but instead, we are getting an empty string back as we are running on unix machine, and this path is not a valid path on unix so it doesn't return C:\ as the root directory. sometimes we are also passing unix valid path.
My Question/Suggestion:
Is there a way we can tell the function to treat this path it is giving the right way? meaning even though we are running on a unix machine we will be able to pass it a windows valid path and a flag stating this is a windows path so it will know to parse it correctly.
if there isn't a way to do that, can I suggest to maybe add that option if this is possible to make?
Example on how it is working on windows vs how it is working on unix:
passing windows path on windows machine: windows example
passing windows path on ubunto: unix example
Thanks,
Ben.
The text was updated successfully, but these errors were encountered: