www.delorie.com/gnu/docs/elisp-manual-21/elisp_390.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

25.6.3 Truenames

The truename of a file is the name that you get by following symbolic links at all levels until none remain, then simplifying away `.' and `..' appearing as name components. This results in a sort of canonical name for the file. A file does not always have a unique truename; the number of distinct truenames a file has is equal to the number of hard links to the file. However, truenames are useful because they eliminate symbolic links as a cause of name variation.

Function: file-truename filename
The function file-truename returns the truename of the file filename. The argument must be an absolute file name.

Function: file-chase-links filename
This function follows symbolic links, starting with filename, until it finds a file name which is not the name of a symbolic link. Then it returns that file name.

To illustrate the difference between file-chase-links and file-truename, suppose that `/usr/foo' is a symbolic link to the directory `/home/foo', and `/home/foo/hello' is an ordinary file (or at least, not a symbolic link) or nonexistent. Then we would have:

(file-chase-links "/usr/foo/hello")
     ;; This does not follow the links in the parent directories.
     => "/usr/foo/hello"
(file-truename "/usr/foo/hello")
     ;; Assuming that `/home' is not a symbolic link.
     => "/home/foo/hello"

See section 27.4 Buffer File Name, for related information.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003