diff options
| author | Jason Rumney | 2008-07-11 23:08:07 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-07-11 23:08:07 +0000 |
| commit | 85d181e19e303653d64b04b825f48ade6e0a268e (patch) | |
| tree | c711967578a6068703d313b1a1807468c37ed287 | |
| parent | 0c8b58e9f7f4c197fc79df247e98fc163b6339c1 (diff) | |
| download | emacs-85d181e19e303653d64b04b825f48ade6e0a268e.tar.gz emacs-85d181e19e303653d64b04b825f48ade6e0a268e.zip | |
(file-truename): Get truename of ancestors if file does
not exist on Windows.
| -rw-r--r-- | lisp/files.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el index cb9720dc702..06d00446eb2 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -859,8 +859,19 @@ containing it, until no links are left at any level. | |||
| 859 | (setq filename (funcall handler 'file-truename filename)) | 859 | (setq filename (funcall handler 'file-truename filename)) |
| 860 | ;; If filename contains a wildcard, newname will be the old name. | 860 | ;; If filename contains a wildcard, newname will be the old name. |
| 861 | (unless (string-match "[[*?]" filename) | 861 | (unless (string-match "[[*?]" filename) |
| 862 | ;; If filename exists, use the long name | 862 | ;; If filename exists, use the long name. If it doesn't exist, |
| 863 | (setq filename (or (w32-long-file-name filename) filename)))) | 863 | ;; drill down until we find a directory that exists, and use |
| 864 | ;; the long name of that, with the extra non-existent path | ||
| 865 | ;; components concatenated. | ||
| 866 | (let ((longname (w32-long-file-name filename)) | ||
| 867 | missing rest) | ||
| 868 | (if longname | ||
| 869 | (setq filename longname) | ||
| 870 | ;; include the preceding directory separator in the missing | ||
| 871 | ;; part so subsequent recursion on the rest works. | ||
| 872 | (setq missing (concat "/" (file-name-nondirectory filename))) | ||
| 873 | (setq rest (substring filename 0 (* -1 (length missing)))) | ||
| 874 | (setq filename (concat (file-truename rest) missing)))))) | ||
| 864 | (setq done t))) | 875 | (setq done t))) |
| 865 | 876 | ||
| 866 | ;; If this file directly leads to a link, process that iteratively | 877 | ;; If this file directly leads to a link, process that iteratively |