Improve documentation of 'file-exists-p'
* doc/lispref/files.texi (Testing Accessibility): Document better how to test for existing dangling symlinks. (Bug#60146)
This commit is contained in:
parent
c9015ef55f
commit
627e7e0243
1 changed files with 8 additions and 4 deletions
|
@ -895,10 +895,14 @@ permissions of the file itself.)
|
|||
If the file does not exist, or if there was trouble determining
|
||||
whether the file exists, this function returns @code{nil}.
|
||||
|
||||
Directories are files, so @code{file-exists-p} can return @code{t} when
|
||||
given a directory. However, because @code{file-exists-p} follows
|
||||
symbolic links, it returns @code{t} for a symbolic link
|
||||
name only if the target file exists.
|
||||
@cindex dangling symlinks, testing for existence
|
||||
Directories are files, so @code{file-exists-p} can return @code{t}
|
||||
when given a directory. However, because @code{file-exists-p} follows
|
||||
symbolic links, it returns @code{t} for a symbolic link name only if
|
||||
the target of the link exists; if your Lisp program needs to consider
|
||||
@dfn{dangling symlinks} whose target doesn't exist as existing files,
|
||||
use @code{file-attributes} (@pxref{File Attributes}) instead of
|
||||
@code{file-exists-p}.
|
||||
@end defun
|
||||
|
||||
@defun file-readable-p filename
|
||||
|
|
Loading…
Add table
Reference in a new issue