[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file-exists-p on empty string
From: |
Michael Albinus |
Subject: |
Re: file-exists-p on empty string |
Date: |
Wed, 27 Feb 2019 15:15:25 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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.
Re: file-exists-p on empty string, Stefan Monnier, 2019/02/27