Comment

Comment by Dwedit

Path names are always really complicated, hidden invisible state or not. Just let use the Operating System's APIs to expand the full paths for you.

Then there's Path Canonicalization. This is especially hairy, and only needed in certain circumstances where you need to know when two paths are really on the same filesystem or not (Mount points and symbolic links can cause "C:\dir\file" to be on a different drive than "C:\"). Not helping this is that path canonicalization is broken on Windows in some cases. When you mount a filesystem, you are able to register the volume with the mount manager. If you do register it, path canonicalization will work, but you also get some unwanted side effects (creating a "Recycle Bin" and "System Volume Information" directory). If you don't register it with mount manager, the files are still usable, but Path Canonicalization won't find the drive. You have to enumerate every drive letter to find it, and if you mounted it inside a directory, that's even harder.

parent Dwedit 13 hours ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton