[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file-exists-p on empty string

From: Stefan Monnier
Subject: Re: file-exists-p on empty string
Date: Wed, 27 Feb 2019 11:15:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> I don't think we can change the above behavior without introducing other
>> odd behaviors.  E.g. currently (file-name-nondirectory "/a/b/") return "",
>> which is consistent with the above behavior.
> ? file-name-nondirectory doesnʼt use expand-file-name anywhere, and we
> can fix file-exists-p without changing expand-file-name, so I donʼt
> follow you here.

It considers "" as the name of the directory, just like `file-exists-p`
and `expand-file-name` (and pretty much all other operations that take
a file name).

This is really not specific to `file-exists-p`: it's a general design of
Elisp's handling of file names.

If we consider "" as an invalid file name, then I think
(file-name-nondirectory "/a/b/") should be changed to return ".", and
I'd be surprised if it's the only change we'd need to do.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]