dealing with very long paths and names

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Sep 15 19:43:13 UTC 2018


On Saturday, September 15, 2018 8:45:55 AM MDT Vladimir Panteleev via 
Digitalmars-d-learn wrote:
> On Friday, 14 September 2018 at 21:16:31 UTC, Jonathan M Davis
>
> wrote:
> > Yeah, though if you write cross-platform applications or
> > libraries (and ideally, most applications and libraries would
> > be platform-agnostic), you can't necessarily avoid all of the
> > Windows insanity, even if you yourself use a platform without
> > those problems.
>
> Linux generally allows you to go ahead and use the filesystem as
> a database, and this works pretty well in a lot of cases.
> Filesystem performance is much better, and so are the limitations
> - not just the path length as discussed in this thread, but also
> the range of valid characters (anything except / and NUL is
> fine). Plus, depending on your choice of filesystem, you get
> bonus features like snapshots, incremental backups, and
> deduplication. It's a boon for prototyping (or Linux-only
> software).

Oh, I don't disagree. I think that in general it makes _way_ more sense to
use a *nix system for development (or most anything else) even if the
software can run on multiple platforms. And actually, the primary reason
that I use the OS I do (FreeBSD) is because of the filesystem (it has first
class ZFS support unlike Linux). However, I'm a strong believer that in
general, software should be cross-platform if it reasonably can be. That's
usually the worst when folks use all kinds of Windows-specific stuff when
they don't need to, but sometimes, Linux-isms do creep into code
unnecessarily.

Either way, while I've occasionally found something that Windows did better
than *nix, far more often, it's shocking how bad their APIs are. And in this
particular case, there really isn't a great solution. Trying to hide the
Windows limitations by translating longer paths so that the Windows API is
risky business, but leaving it up to the programmer to run into it and then
scream in frustration like the OP is isn't great either. And of course, even
if they outright fixed the problem in Windows tomorrow, it would probably be
over a decade before you could rely on it given how long people use older
versions of Windows.

- Jonathan M Davis





More information about the Digitalmars-d-learn mailing list