emacs-devel
[Top][All Lists]
Advanced

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

Re: file-exists-p on empty string


From: Robert Pluim
Subject: Re: file-exists-p on empty string
Date: Wed, 27 Feb 2019 16:43:29 +0100

Michael Albinus <address@hidden> writes:

> Evgeny Zajcev <address@hidden> writes:
>
> Hi Evgeny,
>
>> It was quite surprising for me that
>>
>>   (file-exists-p "")
>>   ==> t
>>
>> I thought that `file-exists-p` resembles stat, such as
>>   
>>   $ stat ""
>>   No such file or directory
>>
>> This is because `file-exists-p` uses `expand-file-name`, which returns
>> current directory for empty string
>>
>> Would not it be more correct for `file-exists-p` to return `nil` for
>> empty string, and if someone wants current directory he will use "."
>> as filename?
>
> I believe the current behavior is correct. file-exists-p calls
> expand-file-name, and (expand-file-name "") returns always
> default-directory.

Thatʼs not described in the doc-string though, so itʼs surprising
behaviour.

Robert



reply via email to

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