comparison lisp/files.el @ 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 b76b9628d74f
children c33982d8abdc
comparison
equal deleted inserted replaced
96615:3f3c7e8d290f 96616:5d72c5c4ec9f
857 ;; This is so that ange-ftp can save time by doing a no-op. 857 ;; This is so that ange-ftp can save time by doing a no-op.
858 (if handler 858 (if handler
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
867 ;; so that we don't use lots of stack. 878 ;; so that we don't use lots of stack.
868 (while (not done) 879 (while (not done)