Skip to content

[Question] Case sensitivity for GetFullPath(string, string) with drive relative paths #97615

Closed
@AnakinRaW

Description

@AnakinRaW

Description

When working with GetFullPath(string, string) and a drive relative scenario, I noticed that the method returns different results depending on the capitalization of the dirve letter.

I was wondering why the check is implemented using ordinal (case sensitive) comparison when I was actually expecting it to be case insensitive.

Looking through the original PR comments dotnet/coreclr#15579 did not help (unless I overread something).

Reproduction Steps

var basePath = "c:/a/b/c/";
var relativePath = "c:test";
var sameButDifferent = "C:test";

Console.WriteLine(Path.GetFullPath(relativePath, basePath));
Console.WriteLine(Path.GetFullPath(sameButDifferent, basePath));

Outputs

c:\a\b\c\test
C:\test

https://sharplab.io/#v2:C4LgTgrgdgPgAgJgIwFgBQcAMACOSB0AkgPIDc66AbgIZjYBG1AzgKYAK1wAFtgLzYAiAMYgA9NVH1RQ0QPJoadMCwA2nAJaV2nHv2EhgLJsDlVa2JtQC2LAEIRgAEXUAzFy2VRgfQQGEDRibyFBhIAJwAFBzc+ADiLMAAYhAqKtFcEcpqwJra3AA0DMx5XACUpfJ4kelxCcmp6RGWNvZOru6ewIWMrOnlpEA===

Expected behavior

I expected the the path's root is checked case insensitive

Actual behavior

the path's root is checked case sensitive

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.IOin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions