]> git.eshelyaron.com Git - emacs.git/commitdiff
(file-chase-links): Delete redundant slashes.
authorKarl Heuer <kwzh@gnu.org>
Tue, 10 May 1994 06:21:55 +0000 (06:21 +0000)
committerKarl Heuer <kwzh@gnu.org>
Tue, 10 May 1994 06:21:55 +0000 (06:21 +0000)
Match `..' only at start of string.

lisp/files.el

index 0a8aca1bd63bf1e1d972daed0dccd4e7de811ecb..eacb4f01eaad786a77b8c355f6995376b6a41787 100644 (file)
@@ -381,11 +381,15 @@ unlike `file-truename'."
     (while (setq tem (file-symlink-p newname))
       (if (= count 0)
          (error "Apparent cycle of symbolic links for %s" filename))
+      ;; In the context of a link, `//' doesn't mean what Emacs thinks.
+      (while (string-match "//+" tem)
+       (setq tem (concat (substring tem 0 (1+ (match-beginning 0)))
+                         (substring tem (match-end 0)))))
       ;; Handle `..' by hand, since it needs to work in the
       ;; target of any directory symlink.
       ;; This code is not quite complete; it does not handle
       ;; embedded .. in some cases such as ./../foo and foo/bar/../../../lose.
-      (while (string-match "\\.\\./" tem)
+      (while (string-match "\\`\\.\\./" tem)
        (setq tem (substring tem 3))
        (setq newname (file-name-as-directory
                       ;; Do the .. by hand.