[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
All the directories in the file system form a tree starting at the root directory. A file name can specify all the directory names starting from the root of the tree; then it is called an absolute file name. Or it can specify the position of the file in the tree relative to a default directory; then it is called a relative file name. On Unix and GNU/Linux, an absolute file name starts with a slash or a tilde (‘~’), and a relative one does not. On MS-DOS and MS-Windows, an absolute file name starts with a slash or a backslash, or with a drive specification ‘x:/’, where x is the drive letter. The rules on VMS are complicated.
This function returns t
if file filename is an absolute file
name, nil
otherwise. On VMS, this function understands both Unix
syntax and VMS syntax.
(file-name-absolute-p "~rms/foo") ⇒ t (file-name-absolute-p "rms/foo") ⇒ nil (file-name-absolute-p "/user/rms/foo") ⇒ t |
Given a possibly relative file name, you can convert it to an absolute name
using expand-file-name
(voir la section Functions that Expand Filenames). This function
converts absolute file names to relative names:
This function tries to return a relative name that is equivalent to
filename, assuming the result will be interpreted relative to
directory (an absolute directory name or directory file name). If
directory is omitted or nil
, it defaults to the current
buffer's default directory.
On some operating systems, an absolute file name begins with a device name.
On such systems, filename has no relative equivalent based on
directory if they start with two different device names. In this
case, file-relative-name
returns filename in absolute form.
(file-relative-name "/foo/bar" "/foo/") ⇒ "bar" (file-relative-name "/foo/bar" "/hack/") ⇒ "../foo/bar" |
[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.