rejeep / f.el

Modern API for working with files and directories in Emacs
GNU General Public License v3.0
685 stars 69 forks source link

Doesn't handle case preserving, case insensitive operating systems #82

Open raxod502 opened 7 years ago

raxod502 commented 7 years ago

On macOS, /path/to/dir is equivalent to /path/TO/dir because the filesystem is case insensitive but case preserving. However, the following function call returns nil instead of t:

(f-ancestor-of? "/path/to" "/path/TO/dir")
phst commented 6 years ago

Handling such filesystems is generally hard or impossible on a library level. For example, there's no way to figure out whether /path/to and /path/TO will refer to the same directory without creating that directory. Maybe the docstring should just document that the comparison is purely lexical (except for converting the filenames to absolute names) and case-sensitive?

raxod502 commented 6 years ago

I think one way to handle such filesystems would be to have a variable that the user could set if they are on such a filesystem.

Leaving the problem to the user would also be reasonable, though.

npostavs commented 6 years ago

This might be relevant:

* Lisp Changes in Emacs 26.1
[...]
** The new function 'file-name-case-insensitive-p' tests whether a
given file is on a case-insensitive filesystem.