File paths in Windows environment not case sensitive?

Windows

Windows Problem Overview


Is it safe to assume that Windows local and network file paths are NOT case sensitive?

Windows Solutions


Solution 1 - Windows

Yes. Windows (local) file systems, including NTFS, as well as FAT and variants, are case insensitive (normally). The underlying implementation of a network file system may be case sensitive, however, most software that allows Windows to access it (such as SMB) will automatically make case sensitive file systems appear as case insensitive to Windows.

For details, I'd read the section in the Wikipedia article on filenames.

Solution 2 - Windows

Case sensitivity on Windows is actually implemented in how the application opens the files. NTFS can be a case-sensitive file system and can happily store files, with identical names differing only by case in the same directory.

On Windows all files are ultimately opened via the CreateFile API - If the FILE_FLAG_POSIX_SEMANTICS flag is passed to the call (and the file system being accessed is natively case-sensitive) then the file will be opened based on an exact name match. If FILE_FLAG_POSIX_SEMANTICS is not passed then the filesystem does a case-insensitive file open and will open one of the files with a matching name. If there is more than one it's undefined as to which one is actually opened.

Most C and C++ runtime implementations on Windows do not provide any access to this mechanism and never use this flag so the only way to get access to case-sensitive behaviors is to use the Windows API directly.

tl;dr - Your language runtime probably exposes your filesystem as case insensitive or case preserving. You can, if you use the windows API directly, access supported filesystems fully case senstive.

Solution 3 - Windows

NO. It is not a safe assumption.

The other answers are informative but regardless of what they say it is not a safe assumption and continues to become more unsafe as time goes on. enter image description here enter image description here

NFST - Can be case sensitive. I use it on a per-directory basis but you can also do it with entire NTFS drives. https://devblogs.microsoft.com/commandline/per-directory-case-sensitivity-and-wsl/

WSL - Is case sensitive. Linux GUI apps, and Android apps coming to Windows. They will all be running on a case sensitive file system by default, locally.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionburnt1ceView Question on Stackoverflow
Solution 1 - WindowsReed CopseyView Answer on Stackoverflow
Solution 2 - WindowsChris BeckeView Answer on Stackoverflow
Solution 3 - WindowsBradView Answer on Stackoverflow