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: Troy Hinckley
Subject: Re: file-exists-p on empty string
Date: Wed, 27 Feb 2019 08:29:45 -0700

I agree with Evgeny. A user would not normally expect (file-exists-p “”) to 
return t. At least I wouldn’t. 

- Troy Hinckley

> On Feb 27, 2019, at 7:15 AM, Michael Albinus <address@hidden> wrote:
> 
> 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.
> 
>> Thanks
> 
> Best regards, Michael.
> 



reply via email to

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