File system paths on Windows are stranger than you might think. On any Unix-derived system, a path is an admirably simple thing: if it starts with a
/, it’s a path. Not so on Windows, which serves up a bewildering variety of schemes for composing a path.
When I implemented the path autocompletion feature in Fileside 1.7, I needed to take a closer look at this to make sure I had all bases covered. This blog post shares my findings.
You think you know everything about file system paths on Windows?
Trust me – you don’t. What on earth.
I was close – I think I knew about everything in here apart from \\.\ (which it turns out I possibly should have used where I’d used \\?\ in the past…)
They’re just scratching the surface of window file system strangeness there. You will see a lot of those if you just open up port 80 to the internet and watch what comes in as bots try to do various path traversal tricks to get files it shouldn’t . I recently unlocked the rare achievement of creating two files in the same directory with the same name. In the past, I made an infinitely large file system on a floppy. NTFS also supports odd things like resource forks and junction points that can lead to more fun situations. There are also many quirks in how different versions of Windows handle such paths, or which apis you use to access a file. My old ancient app was killed by a windows update that changed how windows interpreted file paths, such that an erroneous path that somehow worked in older versions of windows stopped working. There is a whole host of mysteries on one of my computers that I haven’t diagnosed the root cause, its just haunted. Absolutely haunted. Is it a filesystem corruption? windows corruption? Hardware issue? Who knows. I just switched off the computer for other reasons, and haven’t had time to diagnose what the hell happened there.