[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file-exists-p on empty string
From: |
lg . zevlg |
Subject: |
Re: file-exists-p on empty string |
Date: |
Wed, 27 Feb 2019 22:40:41 +0300 |
> 27 февр. 2019 г., в 18:43, Robert Pluim <address@hidden> написал(а):
>
> 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.
>
Yeah, exactly, I’m ok with the current behaviour if it was described in
doc-string!
—
lg
Re: file-exists-p on empty string, Stefan Monnier, 2019/02/27
Re: file-exists-p on empty string, Eli Zaretskii, 2019/02/27