Skip to content

PathUtility.HasExtension doesn't correctly consider case sensitivity of file system #47705

Open
@Youssef1313

Description

@Youssef1313

var comparison = StringComparison.Ordinal;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
comparison = StringComparison.OrdinalIgnoreCase;
}

Only Windows is considered case insensitive, but looks like MacOS is also case insensitive.

I very much recall I have seen code somewhere in dotnet org that tries to create a dummy file, and then calls File.Exists with different casing to determine whether the file system is case sensitive and handle some potential edge cases, but I can't recall where that is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions