Mercurial > emacs
changeset 96616:5d72c5c4ec9f
(file-truename): Get truename of ancestors if file does
not exist on Windows.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Fri, 11 Jul 2008 23:08:07 +0000 |
parents | 3f3c7e8d290f |
children | 4697f48424f2 |
files | lisp/files.el |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Fri Jul 11 18:18:34 2008 +0000 +++ b/lisp/files.el Fri Jul 11 23:08:07 2008 +0000 @@ -859,8 +859,19 @@ (setq filename (funcall handler 'file-truename filename)) ;; If filename contains a wildcard, newname will be the old name. (unless (string-match "[[*?]" filename) - ;; If filename exists, use the long name - (setq filename (or (w32-long-file-name filename) filename)))) + ;; If filename exists, use the long name. If it doesn't exist, + ;; drill down until we find a directory that exists, and use + ;; the long name of that, with the extra non-existent path + ;; components concatenated. + (let ((longname (w32-long-file-name filename)) + missing rest) + (if longname + (setq filename longname) + ;; include the preceding directory separator in the missing + ;; part so subsequent recursion on the rest works. + (setq missing (concat "/" (file-name-nondirectory filename))) + (setq rest (substring filename 0 (* -1 (length missing)))) + (setq filename (concat (file-truename rest) missing)))))) (setq done t))) ;; If this file directly leads to a link, process that iteratively