comparison lispref/files.texi @ 51654:24b62b8f3def

Fix minor Texinfo usage. (file-exists-p): Explain handling of directories, symlinks, etc.
author Richard M. Stallman <rms@gnu.org>
date Tue, 24 Jun 2003 18:16:37 +0000
parents 5a85c7c1d3ab
children ccbf5ac3316d
comparison
equal deleted inserted replaced
51653:a14e8c97cfb9 51654:24b62b8f3def
715 @cindex file accessibility 715 @cindex file accessibility
716 716
717 These functions test for permission to access a file in specific ways. 717 These functions test for permission to access a file in specific ways.
718 718
719 @defun file-exists-p filename 719 @defun file-exists-p filename
720 This function returns @code{t} if a file named @var{filename} appears to 720 This function returns @code{t} if a file named @var{filename} appears
721 exist. This does not mean you can necessarily read the file, only that 721 to exist. This does not mean you can necessarily read the file, only
722 you can find out its attributes. (On Unix and GNU/Linux, this is true 722 that you can find out its attributes. (On Unix and GNU/Linux, this is
723 if the file exists and you have execute permission on the containing 723 true if the file exists and you have execute permission on the
724 directories, regardless of the protection of the file itself.) 724 containing directories, regardless of the protection of the file
725 itself.)
725 726
726 If the file does not exist, or if fascist access control policies 727 If the file does not exist, or if fascist access control policies
727 prevent you from finding the attributes of the file, this function 728 prevent you from finding the attributes of the file, this function
728 returns @code{nil}. 729 returns @code{nil}.
730
731 Directories are files, so @code{file-exists-p} returns @code{t} when
732 given a directory name. However, symbolic links are treated
733 specially; @code{file-exists-p} returns @code{t} for a symbolic link
734 name only if the target file exists.
729 @end defun 735 @end defun
730 736
731 @defun file-readable-p filename 737 @defun file-readable-p filename
732 This function returns @code{t} if a file named @var{filename} exists 738 This function returns @code{t} if a file named @var{filename} exists
733 and you can read it. It returns @code{nil} otherwise. 739 and you can read it. It returns @code{nil} otherwise.
1474 1480
1475 @defun file-name-extension filename &optional period 1481 @defun file-name-extension filename &optional period
1476 This function returns @var{filename}'s final ``extension,'' if any, 1482 This function returns @var{filename}'s final ``extension,'' if any,
1477 after applying @code{file-name-sans-versions} to remove any 1483 after applying @code{file-name-sans-versions} to remove any
1478 version/backup part. It returns @code{nil} for extensionless file 1484 version/backup part. It returns @code{nil} for extensionless file
1479 names such as @file{foo}. If @var{period} is non-nil, then the 1485 names such as @file{foo}. If @var{period} is non-@code{nil}, then the
1480 returned value includes the period that delimits the extension, and if 1486 returned value includes the period that delimits the extension, and if
1481 @var{filename} has no extension, the value is @code{""}. If the last 1487 @var{filename} has no extension, the value is @code{""}. If the last
1482 component of a file name begins with a @samp{.}, that @samp{.} doesn't 1488 component of a file name begins with a @samp{.}, that @samp{.} doesn't
1483 count as the beginning of an extension, so, for example, 1489 count as the beginning of an extension, so, for example,
1484 @file{.emacs}'s ``extension'' is @code{nil}, not @samp{.emacs}. 1490 @file{.emacs}'s ``extension'' is @code{nil}, not @samp{.emacs}.