3 ms·
Windows has, at the kernel level, a single hierarchy of all devices and filesystems. I'd still say the main reason for having drive letters in userspace is back
by ygra 11y ago
Windows has, at the kernel level, a single hierarchy of all devices and filesystems. I'd still say the main reason for having drive letters in userspace is backwards compatibility. Remember how DOS allowed drive letters in front of UNC paths to trick path validation routines? Same thing here. Heck, cmd.exe even continues to support different current directories on different drives [π] (use set " to see the hidden environment variables [−1]) because presumably a bunch of batch files relied on that.
And yes, you can trivially mount volumes in folders [⅜] (at least since Windows 2000, if not for longer). I did this for quite a while, although currently I've gone the other way and use drive letters as short forms for some folders I regularly use (H: is my home directory, for example, also mapped to Home: in PowerShell).
So to shorten all this: From a user perspective there is little difference. A normal Windows user certainly wouldn't care about whether his documents are in C:\Users\Foo\Documents or in \Users\Foo\Documents. For many people nowadays there is only one volume anyway, so C: is just a prefix to the only filesystem hierarchy people care about. From a kernel standpoint things don't need to change either, because there is only a single hierarchy at that level. Which leaves applications running on Windows, where I'd also not see a particularly compelling benefit except for the rare case to iterate all files on all drives which is a two-step process instead of starting at the hierarchy root. So marginal benefit on one side, and the potential to break thousands, if not millions of existing applications, scripts, etc., of which many are probably in use but not supported or updated anymore.
I'd encourage you to read Raymond Chen's blog some day. For an ecosystem as old as Windows (which does not rely on published source code of applications, which could be patched indefinitely to make it run on incompatible newer versions) backwards compatibility is a major reason why it's still used and relevant. And at that point you learn to live with minor historic design issues (MAX_PATH is another; on the other side of the fence, just look how long and painful the way away from X is).
___________
[π] https://blogs.msdn.microsoft.com/oldnewthing/20101011-00/?p=12563 https://blogs.msdn.microsoft.com/oldnewthing/20101011-00/?p=...
[−1] https://blogs.msdn.microsoft.com/oldnewthing/20100506-00/?p=14133/ https://blogs.msdn.microsoft.com/oldnewthing/20100506-00/?p=...
[⅜] http://www.howtogeek.com/wp-content/uploads/2014/05/clip_image017.png http://www.howtogeek.com/wp-content/uploads/2014/05/clip_ima...