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: Eli Zaretskii
Subject: Re: Why does (file-exists-p "") return t?
Date: Sat, 11 Feb 2023 12:39:04 +0200

> Date: Fri, 10 Feb 2023 07:20:01 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: eliz@gnu.org, help-gnu-emacs@gnu.org
> 
> * Edgar Vincent <e-v@posteo.net> [2023-02-10 00:11]:
> > I didn’t know that file-exists-p used expand-file-name, but it does seem 
> > obvious.
> 
> To avoid the problem maybe you should use `expand-file-name' before
> you check it with `file-exists-p'

But there's no problem here.

All Emacs functions that accept file names use expand-file-name
internally before passing the file name to system APIs, because every
file name in Emacs can be relative to the current buffer's
default-directory.  IOW, Emacs pretends to change its current
directory to the buffer's default-directory when you switch buffers.



reply via email to

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