Backslash must die
wpdev.uservoice.com
wpdev.uservoice.com
DOS 1.0 had no subdirectories. There was no slash: you didn't type A:\FOO.TXT, you typed A:FOO.TXT, and the prompt wasn't A:\>, but rather A>. Incidentally, this still works today, and sometimes DOS boots with a A> prompt.
In DOS 2.0, Microsoft decided to add UNIX-style directories, with . and .. for navigation, / as the separator, cd to change directory and so on. But there was a problem.
DOS 1.0 had used / for flags (e.g. DIR /W). Microsoft's solution to this was to switch to - for flags, but IBM didn't like this change. So Microsoft compromised on using \ as the directory separator and kept / in use for flags.
However, Microsoft clearly didn't like having to make this change. How do we know this? Well, DOS nonetheless also supported / for directories (and thus its successors, including Windows NT do), and, at least for a little while, contained a setting which let you use - as the flag character.
P.S.: VMS/OpenVMS, which was designed by David Cutler (the same guy who later designed Windows NT after he was poached by Microsoft), used . as directory separator (https://en.wikipedia.org/w/index.php?title=Files-11&oldid=68...)
Edit: forgot a few parts of the qualified path.
Many UIs get confused on forward slashes though (file open dialog, stuff like that), and given that the vast majority of people, worldwide, that understand what files and directories are, believe backslashes are the way to go, I doubt MS is ever going to change this.
But from personal experience - I've programmed cross-platform stuff on Windows for very many years, and I never bothered about backslashes. In all honesty I never understood all the open source stuff that comes with DIRECTORY_SEPARATOR global constants or eslint rules that tell you to use path.join() instead of `dir + "/" + subdir`. The forward slash just works, and it has worked for ages.
The only "problem" is that at times you end up concatenating paths together and end up with stuff like
C:\Temp/mydir/2/..\file.txt
That's a bit quirky in log file and in the debugger. But fopen eats it just fine.Sure there might be cases where this is a problem, probably the libraries I've seen code around backslashes have good reasons, but really for end-programmers it's no biggie.
Now, MAX_PATH, that's something else. That should die in a fire and it blows my mind that it hasn't been addressed yet.
And if you do, do you have a source on why?
Also, yeah, can anyone clarify what the deal with the max path length is? And why it's possible to create a path above the max length but not to simply delete it from the filesystem?
Honestly, 99.99999999% of people use one or the other because that was what the platform they are on used. Very few people were involved in the back vs. forward slash decision.
I hear people identify the characters incorrectly ALL the time.
I first encountered this issue when helping new developers get started with NPM on Windows; older NPM versions produced deeply-nested node_modules trees that could easily overflow the limit.
Not sure you got that right. I'm certain there are more people that use forward slashed in a browser (every OS+mobile) than people who type backslashes in Windows.
My mother has used Windows for years and doesn't even know where the backslash character is. She can type URLs though.
It's a very common mistake.
"Please visit our world wide web home page at aitch tee tee pee colon, forward slash forward slash, acme period see oh em."
If you leave out the double-you double-you double-you period, the world wide web home page won't even work! You get like a dragon lizard or something.
Thank you for reminding me. I think.
The code I write is regularly ported between OSX, Linux, and Windows, and I routinely make it work with both, as well as being agnostic about line endings.
The opposite problem, Linux programs not working well with CRLF, is there as well. I find git to be more or less unusable with CRLF source files, so I run a 'tolf' utility on all checkins. Linux programs ported to Windows tend to run poorly, like being case sensitive on filenames in some places but not in others.
I knew I could get away with using forward slashes in Perl and PowerShell, but I had assumed these were hacks in Perl and Powershell respectively, in order to make Unix-people feel slightly more at home.
> Now, MAX_PATH, that's something else. That should die in a fire and it blows my mind that it hasn't been addressed yet.
In a way, it has. AFAIK, internally Windows can handle paths that are far longer than MAX_PATH, but since so many applications have been written with the assumption that a path can never be longer than MAX_PATH, apparently Microsoft felt if somebody passed a longer path to an API function, that probably indicated some programming error, a buffer overflow or something like that.
But apparently, if you write a path like \\?\C:\Some\Really\Long\Path\With\Lots\Of\Nested\Subdirectories\And\A_Ridiculously_Long_Filename_In_It.RandomLongFileExtension then the path can be fairly long. I think there still is a limit of something like 64KB, but that should, as they say, be enough for anyone. ;-)
Still, I agree, MAX_PATH and network shares have given me a lot of pain - if you have have file server with a folder like D:\Network_Shares\Accounting that is mapped to, say, the drive E: on some client, the client can create files whose local path on the server will exceed MAX_PATH, causing e.g. backup software to choke.
And this happens quite a bit, because our project engineers store project-related files in an elaborate, very deep folder hierarchy; I appreciate they want to organize their files, but sometimes I just want to slap them.
While at it, I also wish if Linux distros could get done with case sensitiveness in filenames. Is there any advantage to allowing both Filename.ext and filename.ext? The only time I seen this is when a malware is trying to stay hidden. Also some naming conventions would be nice, when you can have any character including '/' and '.' as a filename, it gets annoying to deal with them in a cli.
Sorting by ascii order put capitalized files to the top of the list. Exactly where you should look for important stuff like README and Makefile.
Case preservation without case sensitivity is just dumb. Why bother, because it's pretty? Also, what's up with spaces in filenames? And furthermore, what are all these kids doing on my lawn?
What's_up_with_spaces_at_all? Let's_just_join_sentences_with_underscores_for_clarity.
Such an utterly minuscule amount though (especially in the modern times when storage and bandwidth are cheap and ubiquitous), I think you typing that sentence has wasted more storage and bandwidth.
I think a better reason is to avoid issues when working with code files across systems and version control. This actually causes major annoyance.
Sent a bazillion and one times all day, every day. I'm sure it adds up.
My point is that there's no shortage of digital storage space and bandwidth is only getting better. And if CRLF does cause a shortage of storage and bandwidth, I'm sure MS would address it.
The only widely used file system without case sensitivity is HFS[1]. NTFS to its credit is case sensitive, but Win32 is not, for legacy reasons (same reason as why MAX_PATH still plagues Windows).
[1]: https://en.wikipedia.org/wiki/Comparison_of_file_systems#Fea...
[1] https://helpx.adobe.com/creative-suite/kb/error-case-sensiti...
file = open(path, "w", newline="\r\n")Given this is fixed in RFCs, it is unlikely to ever change
None of that stopped UNIX from getting away from it, and the internet is basically built on UNIX. What transformations the C FILE stream implementation makes to linefeeds has nothing at all to do with TELNET, SMTP, FTP, or HTTP. These are very separate areas of concern. In Windows if you're writing socket code you have to explicitly write the \r and the \n, just like on any other platform.
Apparently Mike Muuss compared the two implementations, and his recommendation to go with Bill Joy's code was the decisive factor.
[1] https://www.youtube.com/watch?v=ds77e3aO9nA - I think that's the one
But to clarify on the salient part, I was trying to say that UNIX diverged (successfully) from what came before it, and the CRLF behaviour was from the teletype era that the early internet started in. My point about UNIX being a building block of the (modern) internet was more about pointing out that if UNIX could diverge from that and be a key component of the internet, it's absurd to think that Windows could not.
I can definitely understand how you got where you did from what I said, though.
Though this is more of an artifact of terrible specs and the IETF's silly love affair with "free" text formats. They actually take delight in showing off how crazy the encoding can be.
* http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/qm...
Yes, Unicode is messy and could have been better designed (it was designed so that there is an easy conversion path for any pre-existing encoding – thus concerned itself more with making it easy to convert content in legacy encodings to Unicode, instead of making it easy to implement applications in a way that they support Unicode), but it's still orders of magnitude better than anything that came before it when it comes to representing text in general. And it's mostly complicated because languages and scripts are complicated.
Yes, cat comes from simpler times, but if cat cannot be changed for compat reasons, then it should no longer be used to concatenate text files. At least if the result is somehow important. Text and binary data are simply two very different things and both need to be processed accordingly. Sure, there are a bunch of other operations that are immediately recognisable as not making sense on text at all and superficially concatenating files is not one of them, but in my eyes that's a bit shortsighted. You can safely use methods for binary data on text iff you know exactly what your text contains and that the operation is safe. Otherwise you may mangle things.
Microsoft must have thought to themselves in the early 90's: "Gee, we should support unicode... that means we need wider characters, right? Two bytes ought to be enough. Ship it!" Then when it became clear that two bytes wasn't enough, they didn't want to replace all the types for those win32 API calls, so they said "Well, let's just pretend that the two-byte encoding was actually UTF-16 all along", which is both variable width (which has all the problems UTF-8 has with invalid encodings), and it's wasteful in size (all ASCII text is stored with two bytes per character). It's literally the worst of both worlds.
Except it was Unicode which was a 16-bit code back then which got changed into 21 bits with Unicode 2 which also morphed UCS-2 into UTF-16. This happened in 1996, when Windows NT already existed. Blaming Microsoft (and Sun, and Netscape, ...) to follow a standard is a bit out of place. Heck, while UTF-8 everywhere would be nice, things are still messy and various different encodings are rampant. At least UTF-16 is immediately recognisable, as opposed to all the legacy encodings.
But at least in Unicode 2.0 in 1996, the definitions they finally gave were UTF-7 and UTF-8. UTF-16 didn't become standard until 3.0 in 1999, when it became apparent that they couldn't take the first 5 years back, and too much software was already written assuming 16-bit characters.
My point is that UTF-16 is a completely worst-of-both-worlds hack that nobody would implement in a vacuum, short of a need to maintain compatibility with a 2-byte character API. The only reason it exists is because people (the Consortium included) truly for a brief period thought a 2-byte character set would actually be enough, and then had to figure out a way to preserve compatibility later.
Meanwhile the UNIX world thankfully seems to have gone straight from ASCII to UTF-8 without any awkward dead-end in the middle [1], because if you need to maintain backward compatibility with anything, it's a lot more useful (and space efficient) for that something to be ASCII.
[1] Sure, there exists wide-character versions of all the posix standard APIs, but in practice all the other API's you're likely to use in UNIX land have converged around wrapping the 8-bit character versions.
That would really have been too much skeuomorphism in our text file format.
What is RUBOUT? It's a character with all 1 bits. On a paper tape, a punched hole represents 1 and lack of a punch is 0. So a RUBOUT character has all the holes punched out.
And by convention, RUBOUT is ignored when a tape is read.
If you made a mistake punching a tape, you would type BACKSPACE RUBOUT. BACKSPACE wasn't a character itself; it would physically back up the tape by one character position. RUBOUT then punched out all the holes, in effect erasing that character.
To go to the next line, you would punch RETURN to return the print carriage to the beginning of the line, and LINE FEED to feed the paper to the next line. But unless you were daring, you'd follow these with a RUBOUT to give the machine a little more time for all this mechanical movement.
I actually forgot where it works because
- if I try to open a file `i:/foo/bar/test.txt` I get `The file name is not valid` (from Notepad)
- if I try to open a folder `i:/foo/bar` I get `The folder name is not valid`
- if I try to `cd /foo/bar` I get `The system cannot find the path specified.`
Windows really should have just one file open dialogue, etc.
Each of these has its own special list of "favorites" on the left, so if I want to add a shortcut to a commonly used folder, I find myself doing it in 8 different places. Or in some cases I can't; Acrobat has a sidebar with large icons of Recent Places, Desktop, Libraries, Computer, and Network. If you wanted to add somewhere more useful, you're shit out of luck.
Anyone know why this happened? Was there a period around Windows XP where the built in dialog was just godawful and everyone said "Fine I'll make my own" and then they never went away?
Compare to OS X where any time someone rolls their own dialogs for system features (especially Open and Print), I immediately assume the developer is an asshole. And for the most part, nobody does it. The only one I can think of off the top of my head is printing from Chrome, and theirs even includes a "Print using system dialog…" button.
Then Windows Vista came along and we were introduced to the "Common Item Dialog" [1] which is now the recommended way to File Open/Save.
> Acrobat has a sidebar with large icons of Recent Places, Desktop, Libraries, Computer, and Network.
Possibly your version of Acrobat is either older, or Adobe haven't bothered themselves to get with the present and implement the Common Item Dialog, or if they do they're customising it...or even worse it's a subclassed franken-dialogue. But I feel and appreciate your pain.
These two (fairly old) blog posts discuss the maddening situation with Windows file dialogues:
http://insanecoding.blogspot.co.uk/2007/03/file-dialogs.html
http://insanecoding.blogspot.co.uk/2007/04/file-dialogs-take...
[0]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...
[1]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb7...
Thankfully not one I run into regularly.
To add to the sibling comments...
From MSDN "Windows continues to support the old-style Open dialog box for applications that want to maintain a user-interface consistent with the old-style user-interface"
No, no and thrice no. If I'm on Win 7, everything should look Win 7 consistent. Likewise if I'm on 10 it should all look 10, perhaps with necessarily reduced functionality if it's a deprecated call.
If I'm running Visual Studio on 7, I don't want all my icons, and GUI to be of 10. No matter how diligently you upgrade, there is always something visually out of step. Even with only MS software.
I suspect it was the very late arrival of a Windows Style Guide made a lot of developers get the habit of doing their own thing. Then they'll start faffing around with variations so you can have preview in open. Hell, might as well do our own everything. The rules didn't say you shouldn't.
Mac always had a pretty tight, and extensive, Style Guide with apparently thought down to individual pixels; Windows seemed not to care, or not understand when it did care. Around XP Windows started caring more about UX, but probably far too late.
I had a quick skim, Elementary talk good sense. It's this apparent trivia that makes the experience. Like can dialogue text be copied, or how a menu opens, and why. Or what shortcut keys to use and when. Or always use the default file open as it'll automatically upgrade visuals and at least some capability when the next OS release comes along. :)
Play along and the user will know how to print, open, copy, preview and a hundred other things on the first ever use of your new program leaving them just to learn the unique new thing.
I kept my Amiga Guidelines phonebook[1] for years after the machine was effectively dead as the principles and explanations were still sound. The Apple Guidelines[2] were worth owning whether you used a Mac or not, again for the principles, and would often get recommended. I had a copy years before I ever touched a Mac! Life got simpler when they were all online.
I don't think it matters where you take cues from, so long as you are internally consistent, and apps carry on that consistency.
[1] http://www.amazon.com/AMIGA-User-Interface-Style-Guide/dp/02... [2] http://www.amazon.com/Macintosh-Human-Interface-Guidelines-C...
This is a big difference, and in the end a classical one, in the way companies typically work compared to open source projects (not just open source code, I'm really talking about the whole project being open): in companies teams or individuals just don't collaborate as much, because projects are often extremely closed even within the companies, with all kind of access rights. And also some app team might want to support really old OS (who uses a Linux distro of 2009 today? Well, OTOH tons of people are using a Windows version from 2009...) for a few more years and that OS certainly won't add any kind of support for the UI the app guys want, and the app guy might not want to use loads of resource to make their app look neatly graphically integrated in old OSes.
In summary, for proprietary stuff, this is an hard problem both at the technical and at the organizational level, especially if you like to change your graphic experience so often like MS does. And now everybody is used to seeing widely inconsistent stuff on the same screen anyway, so old on new / new on old / different on different cases will remain, I guess. Plus converging UI from vastly different devices is also a hard problem in itself, and UWP is actually not bad at it -- but the price is obviously that it must be irrecoverably different from old Win32 programs.
I understand a lot of the baggage they're carrying for keeping compatibility and suffering 20 year old choices etc. I can't help but feel that 7 or 8 should have drawn a hard MacOS/OSX like line under things and given us a modern windows with newer choices. Add a VM for running your old XP app. Throw cmd and dos away entirely.
I actually respect MS for being brave enough to experiment with the GUI as much as they have, yes and get it terribly wrong sometimes. A classic fallback, or a 7 fallback for 8 would have made the 8 fail easier to bear.
Not entirely sure the company / open comparison is the whole story. Someone somewhere designed metro (or 7, or 10), figured out a UI and design language, and had some principles behind it. Those could be made the contract for the team's software being seen in the world. Again Windows has it more complex as so much of the GUI ends up in the .exe, so what you see is when it was made not what it runs on.
I think you're right in that having got where we are, it's unlikely to easily improve.
This was easy to do: after opening the dialog but before it was displayed, you just walked through its child windows to add your own controls where you wanted them, and increased the dialog height to make room.
But Windows didn't know you would be doing this until it was too late. The modifications were done after you called the Windows API to create the dialog.
If it weren't for this compatibility issue, Microsoft would have been delighted to just replace the old dialogs with the new ones wholesale.
It is commands at the command line that insist on the difference.
1st and 3rd examples work from PowerShell.
An example from Microsoft's documentation:
dir c:\*.txt /w/o/s/p dir "c:/*.txt" /w/o/s/p cd\windows
I explicitly and deliberately differed from this when I wrote a command interpreter.* http://homepage.ntlworld.com./jonathan.deboynepollard/Softwa...
C:¥Windows¥System32.
I can only imagine the difficulty of something like this, given all the legacy code and backward compatibility issues. Perhaps intelligently rollback to C:\ style paths when apps use backslashes. For Program Files, they might as well continue using /Program Files/ since it's not all too different from /opt.
ln -s /mnt/c/Users /home
ln -s '/mnt/c/Program Files' /opt
...Windows does internally - even in a network-transparent way:
https://en.wikipedia.org/w/index.php?title=Path_(computing)&...
I remember one installer that didn't understand this (I think it was Steam) and concluded it wouldn't install to C:\Stuff\foo because there was insufficient disk space under C: - it was looking at the free space of C: (the SSD) instead of C:\Stuff .
There's also plenty software out there that confuses volumes with drives and tries to enumerate the latter when it should be enumerating the former.
Coming soon :)
I've never understood that. The only way I could explain it in the 90s was because "computers use backslashes" due to the ubiquitousness of DOS and Windows paths. Now, who types a path on their local machine besides developers using a command line?
PS C:\Users> cd /
PS C:\> cd //localhost/c$
PS Microsoft.PowerShell.Core\FileSystem::\\localhost\c$>
* I found someone asking the same question as me in 2005 (!) [1]
* Per someone on Stack Overflow: "/ can be used as a path separator at the API level, but you aren't calling the API directly. You're using cmd.exe, and cmd.exe parses the / as a command line option" [2]
* Later in the same Stack Overflow discussion someone performs a series of tests on Vista, with some inconsistent results. [2]
* Here's a history by veteran Microsoft developer Larry Osterman, which takes us back to the developers of MS-DOS and also mentions other undocumented ways MS-DOS can/could be made Unix friendly. [3]
-----
[1] https://bytes.com/topic/python/answers/23123-when-did-window...
[2] https://stackoverflow.com/questions/10523708/why-does-the-cm...
[3] https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/wh...
According to the history, DOS 2.0:
https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/wh...
[begin quote] Here’s a little known secret about MS-DOS. The DOS developers weren’t particularly happy about this state of affairs – heck, they all used Xenix machines for email and stuff, so they were familiar with the nix command semantics. So they coded the OS to accept either “/” or “\” character as the path character (this continues today, btw – try typing “notepad c:/boot.ini” on an XP machine (if you’re an admin)). And they went one step further. They added an undocumented system call to change the switch character. And updated the utilities to respect this flag.
And then they went and finished out the scenario: They added a config.sys option, SWITCHAR= that would let you set the switch character to “-“.
Which flipped MS-DOS into a nix style system where command lines used “-switch”, and paths were / delimited. [end quote]
Guy1543, thanks, I did not know that. And I wish I had known it sooner. :-)
They can't retroactively change MAX_PATH because it's a constant that's compiled in every application that uses it. Well-written applications these days will just do the \\?\ thing and be done with it. The downside of that is that you can get paths Explorer doesn't like. And I'm guessing Explorer explicitly doesn't allow you to create paths longer than MAX_PATH to prevent people complaining about »I created a folder in Explorer and copied a file there, but now I cannot open it.«. Keep in mind that (usually) developers can be expected to find solutions, but making it easy to frustrate regular users (of which the OS has at least a few hundred million) is not the best strategy to keep them using the OS.
Of course, there are also heaps of software that cannot use above method to allow for longer paths because they don't use the Unicode APIs. Maybe because some developers think supporting Windows 98 is a good idea nowadays, or because they just don't know any better. And in that heap there's a lot of poorly-ported open-source software, too.
[½] https://msdn.microsoft.com/en-us/library/windows/desktop/aa3...
The directory structure made some sense, that is, it was sane and rational. But it should've been split across several network drives to keep things shallower given the limitation.
See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa3...
* Forward slashes in paths but only 260 characters as max path length
* Maximum total path length of 32,767 characters but not forward slashes as path separator
Pick your poison.
http://ux.stackexchange.com/questions/92390/why-is-backslash...