Re: (expand-file-name "/..")
"Stephen J. Turnbull" <[email protected]>
| Newsgroups | gmane.emacs.xemacs.beta |
|---|---|
| Message-ID | <[email protected]> |
Mats Lidell writes: > >>>>> Stephen J Turnbull <[email protected]> writes: > > > file-truename actually follows the path on the device. > > I'm confused (and possibly stupid!). (file-truename "/foo/bar/..") > gives "/foo" on my system (XEmacs 21.5). I have no "/foo" directory > on this machine. So what does "actually follow the path on the > device" mean? I'm not sure why this makes sense, but file-truename does expand-file-name (or the equivalent in C) first. Then it eliminates symlinks. So /foo/bar/.. -> /foo # expand-file-name -> / + foo # / exists and has realpath "/", foo does not exist -> /foo # appends remaining components or something like that (I don't have time to look at the code, but it's pretty hairy IIRC).