News for hackers. Stuff that matters.
Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Wednesday April 24, 2024 @06:06PM (#40150363)
When you open Explorer and click in the address bar - what path separator is displayed? How about when you install software - what path separator does it show?

> Win32 file APIs can actually use either '/' or '\\' as a path separator.

Fantastic - so why are we still entertaining this idiotic file separator everywhere within the OS itself?

> '\\' was selected by DOS, specifically DOS 2.0 per TFA, before OS/2 existed

Fine - so why the hell are we still doing things like a dead, defunct OS did and literally nobody else did because, you know, it was unintelligent?

Re:Why Does Windows Use Backslash as Path Separator? by nullindividual on Wednesday April 24, 2024 @06:09PM (#40150418)
Microsoft was very smart to use the backslash. It lead to unrivaled backwards compatibility.

Saying it was the wrong choice is simply revisionist history.

Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Wednesday April 24, 2024 @06:13PM (#40150471)
So, we would lose all backwards compatibility by writing a \ -> / converter? I don't buy this logic at all - in fact, as others have pointed out, Windows will accept both separators these days.

You are, unintentionally, being the very sort of apologist my post above complained about.

Re:Why Does Windows Use Backslash as Path Separator? by naikrovek on Wednesday April 24, 2024 @06:53PM (#40150867)
I think you just need to get over whatever is making you angry. Non-POSIX systems exist, dude. It’s ok for things to exist…
Re:Why Does Windows Use Backslash as Path Separator? by asveikau on Wednesday April 24, 2024 @06:55PM (#40150882)
Tempted to bring in the fact that classic Mac used colons as a path separator.

As TFA says it wasn't clear yet that unix would be so dominant. Also, a lot of these systems were introducing the concept of directories for the first time in their history. That's how old we're talking. That directories are novel to some people at that point.

Re:Why Does Windows Use Backslash as Path Separator? by nullindividual on Wednesday April 24, 2024 @11:26PM (#40153060)
Personal attacks are not welcome on HN.

Microsoft wrote a 'converter'. Terminal, Explorer, and other applications recognize "/" and convert it to "\". If it takes both, it doesn't matter which one is "real".

Re:Why Does Windows Use Backslash as Path Separator? by lproven on Thursday April 25, 2024 @06:45AM (#40155801)
> You are, unintentionally, being the very sort of apologist my post above complained about.

Hint: the post you are replying to is humorous and the tone should be read as sarcastic.

Re:Why Does Windows Use Backslash as Path Separator? by nullindividual on Thursday April 25, 2024 @10:34AM (#40158089)
No, it wasn't and no, it shouldn't be read as sarcastic. Microsoft should be praised for the backwards compatibility they enabled. That is a feat rare in operating systems today.
Re:Why Does Windows Use Backslash as Path Separator? by lproven on Thursday April 25, 2024 @01:21PM (#40160409)
All right, but in that case, I must ask you to explain the comment, because it make no sense to me at all.

Firstly, the choice of backslash in DOS 2 didn't enable backwards compatibility with anything because nothing prior to DOS 2 used the backslash character for this.

Secondly, I do not see any basis to say that somehow MS looked forward in time, at the future, and chose a character unused by any other OS.

As early-1980s MS did not have a time machine and thus was not looking forwards, then how did that choice help future compatibility? How was the use of backslash better for Windows for Workgroups 3.11 (because that was the first one with its own VFAT filesystem that didn't just call DOS) and subsequent releases? How was a backslash preferable to anything else?

How would using any other character be worse?

Would choosing a character used by other OSes not have been _better_ for long term compatibility, aiding source code conversion and porting?

I really do not see what you are trying to get at.

Incidentally, I entirely agree that its compatibility record is astonishingly good, but I can't see any link from that to the choice of directory delimiter.

Re:Why Does Windows Use Backslash as Path Separator? by nullindividual on Thursday April 25, 2024 @05:19PM (#40163168)
When one speaks of Microsoft's backwards compatibility, they are referring to within the Microsoft domain of operating systems and APIs. If I can run an application from 1985 on modern day Windows, that is what backwards compat refers to and is quite unrivaled -- remember, the most stable ABI on Linux is Win32.

> How was a backslash preferable to anything else?

Because it existed prior to Windows 1.0 and beyond application compatibility, you also had to work with user familiarity. Heck, it is annoying enough to swap between macOS and Windows for Ctrl/Cmd-C and Ctrl/Cmd-V, or even within macOS between Mac applications and the Terminal. Or my worst personal enemy, Ctrl-H/Cmd-H (browser History vs. hide window) in a browser. Arg!

> Would choosing a character used by other OSes not have been _better_ for long term compatibility, aiding source code conversion and porting?

Which OS should they have chosen from? [0] Apple SOS [and all future versions of macOS]? VMS/OpenVMS? RiscOS? Domain/OS? TOPS/20? Stratus VOS? What made SysV or BSD special or 'a clear choice' in path separators in the '80s?

> How would using any other character be worse?

I don't believe any other character would be better or worse at the time backwards compatibility was ruled supreme at Microsoft. Since their operating systems already used the backslash character, and the preceding mention of user familiarity, and of course the code base is DOS which they probably didn't want to re-write due to effort and cost, they stuck with it.

I certainly see a point in changing the path separator if you pulled a Mac OS Classic to Mac OS X style switch, but Microsoft never really did that. Yes, they had NT, but that needed to have compatibility with it's DOS-based sibling as it could also run DOS applications.

Oh imagine the threads if they did switch to the forwardslash in Windows... "What else from Linux will Microsoft copy?!" "Did Microsoft switch to the Linux kernel?!". It would make for an exciting day in tech!

I'm certainly not against Microsoft changing the path separator to the forwardslash.

[0] https://en.wikipedia.org/wiki/Path_(computing)

Re:Why Does Windows Use Backslash as Path Separator? by Capricorn2481 on Wednesday April 24, 2024 @06:11PM (#40150448)
> Fine - so why the hell are we still doing things like a dead, defunct OS did and literally nobody else did because, you know, it was unintelligent?

Nobody is doing it except the people using cmd.exe over Windows Terminal or Powershell. If you're using a DOS terminal you're gonna get DOS results.

Re:Why Does Windows Use Backslash as Path Separator? by asveikau on Wednesday April 24, 2024 @06:09PM (#40150417)
> Fantastic - so why are we still entertaining this idiotic file separator everywhere within the OS itself?

Dude, why are you so angry about what direction a slash goes?

Once they introduced the ability to use either one, they still had a lot of software that hardcoded '\\', including lots of their own. Again, they support either one in most places. The backslash is considered more canonical because it came first.

Going back to DOS for a second, TFA even says Microsoft wanted to use '/' in DOS 2.0 when they introduced directories (1983), but IBM objected.

Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Wednesday April 24, 2024 @06:24PM (#40150583)
IBM objected in 1983 - yet that decision lives on today? It's what Windows displays to users, even if you can actually type in / and things still work.

When Microsoft wrote IIS and other web technologies the internal friction of path separators must have been fun to experience. "Why are we still using \ again, Jim? Oh, that's right, we chose poorly a decade ago and for some reason can't be bothered to fix it!"

> Dude, why are you so angry about what direction a slash goes?

Because it's rubbed my bum raw over the years and I've finally had enough! I mostly jest... but seriously, it's super annoying to deal with and a constant reminder of the poor decision making Microsoft products often encompass.

Re:Why Does Windows Use Backslash as Path Separator? by asveikau on Wednesday April 24, 2024 @07:11PM (#40151036)
Parsing a URI should not be a straight pass to open(2) [or CreateFile in Windows parlance] to get to the filesystem directly anyway ... Think of the security problems with that, or URIs where they don't actually correspond to filesystem objects. So, IIS already needs to parse the path distinctly. I'm going to say it didn't cause them a lot of trouble.

Note also that Windows tends to use 16 bit Unicode everywhere, that's probably a bigger thing for IIS than the path separator.

Re:Why Does Windows Use Backslash as Path Separator? by foobarian on Wednesday April 24, 2024 @06:48PM (#40150809)
You know what happens when you write a \ --> / converter? You get the python2 to python3 migration mess. Except with Windows it would have been millions of mom and pop shops left out in the lurch.
Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Wednesday April 24, 2024 @06:56PM (#40150894)
No it wouldn't - because Microsoft did write a \ -> / converter and none of this bad stuff happened.

Microsoft just chooses to still display \ to you in the UI... which is ridiculous and perpetuates \ living on in all user-facing places.

Re:Why Does Windows Use Backslash as Path Separator? by foobarian on Wednesday April 24, 2024 @08:10PM (#40151571)
Are we arguing different things? I.e. removing support for \ altogether from anywhere in the OS vs. not showing it in UIs?

I personally like the latter but it's a matter of taste I guess :-). It gives me warm and fuzzies to see C:\ D:\ etc. live on.