tomprogers/filesystem-path

intelligent handling of "C:"

Opened this issue · 2 comments

Last time I used Windows, every path began with a "drive letter":

C:\Documents and Settings\tomprogers\Desktop\file.ext

There's no equivalent on *nix filesystems.

It's almost certainly very bad to treat "C:" as the first "folder". Ideally it'll be represented as an extra path prop, perhaps drive or something.

Research these things.

  • are they always a single letter? (i.e. keyspace of 26)
  • do they always include the colon?
  • what are they really called?
  • is this a Windows thing? or an NTFS thing? what technology is responsible for them in the Windows ecosystem?

It looks like C: is called the "drive letter", and it really is true that such filesystems are limited to 26 drive-letters, A-Z.

  • Microsoft, calling them "drive letters"
  • Wikpedia, talking about the range of letters

Windows technically permits forward slashes as well as backslashes, although a single path cannot use both simultaneously. And if the path uses backslash, you have to handle command switches differently, because Windows terminal uses forward slash instead of dash (e.g. dir /w).

Windows does have a special meaning for if the first sep is doubled. Windows also considers some paths "absolute." Gotta go back and capture the details.

One key finding: don't assume that sep='/' implies *nix. Consumers working with Windows paths will need to be able to convert to either sep without fuss.