[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add a predicate for canonical file name
From: |
Stefan Monnier |
Subject: |
Re: Add a predicate for canonical file name |
Date: |
Mon, 12 Sep 2016 16:01:57 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> Using string= here will cause false negatives, e.g. with Windows file
> names that use backslashes vs forward slashes, or due to letter-case
> differences on case-insensitive file systems. Did you really mean
> that?
Indeed, such notions have already been requested and discussed here, and
it's not clear exactly what is needed and when.
I can see several different meanings of "canonical", i.e. representative
member of an equivalence class (and I'd be inclined to prefer a function
that checks for "equivalence" between two file names rather than
a function that tries to find one canonical name). The equivalence
classes could be:
- equivalent regardless of the actual on-disk data. I.e. this can't
take symlinks or hard links into account. Questions remain about
whether it could presume the "normal semantics of the most common
file-system". E.g. should it assume case-insensitive names in
MacOS/Windows and case-sensitive in GNU/Linux?
- equivalent in practice for the current state of the file-system.
You can test this equivalence by comparing the output of
`file-attributes', except when the name corresponds to a file that
doesn't exist (yet?).
Which flavor do you want?
Stefan