Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Windows uses drive letters and backslashes, unix has a root filesystem with forward slashes.

Windows also has mountpoints. When I use a Windows system, I pretend that C: is the only drive, and mount external volumes under the root, Unix-style. I then install Cygwin in the C:\ root, creating the illusion of a fairly Unix-ish filesystem layout.



And you can also use forward slashes. I've used them in applications (Java apps, NodeJS apps, etc) and in the command line since at least Windows 7.


The forward slash (/) as a directory separator has always been acceptable to NT. One source says that it's been acceptable to DOS since DOS 2.0, although I don't have a lot of backing on that.

The only place that / as a directory separator doesn't work is when interpreted by cmd, as it's then ambiguous with DOS-style switches. And even then, modern cmd tries to understand / properly when possible. Most of the time it works as long as it is not the first character of a path (which you would not frequently see in Windows anyway), as there's then no way to tell it apart from a switch with a long name.

The canonical representation of paths in Windows uses a backslash, but 95% of the time the slashes are interchangeable.


IIRC (it's been a while), the native NT API does _not_ accept backslashes; win32 converts forward slashes to backslashes when passing along filenames to NT. The distinction doesn't matter very much, though, since very few people use the NT native API.


> One source says that it's been acceptable to DOS since DOS 2.0

I can confirm that from personal memory.

At the time, the biggest vendor of UNIX-like systems was Microsoft (Xenix), so compatibility was a benefit. They soon sold that product off, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: