help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Why does (file-exists-p "") return t?


From: Bruno Barbier
Subject: Re: Why does (file-exists-p "") return t?
Date: Sat, 11 Feb 2023 20:34:38 +0100

Jean Louis <bugs@gnu.support> writes:

> * Bruno Barbier <brubar.cs@gmail.com> [2023-02-11 13:10]:
>> > As otherwise you may check the wrong path.
>> 
>> Why ?
>> 
>> One of the first thing `file-exists-p' is doing is to call
>> `expand-file-name' to expand the file name.  I don't see how calling
>> `expand-file-name' before would help.
>
> I understand you and I am sure in most use cases it is not necessary
> as it will be expanded later. 

>
> Sometimes I wish to expand it before for reason that
> `default-directory' sometimes changes:

IIUC, you are saying that it may be better to expand immediately and to
use the expanded version, to not risk the file to be expanded later,
possibly in a wrong/unknown context.

Very good point, indeed.

Thanks for the explanation and the advice, Jean.

Bruno



reply via email to

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