]> git.eshelyaron.com Git - emacs.git/commitdiff
(insert-directory): Don't call access-file on
authorEli Zaretskii <eliz@gnu.org>
Wed, 9 Aug 2000 12:01:09 +0000 (12:01 +0000)
committerEli Zaretskii <eliz@gnu.org>
Wed, 9 Aug 2000 12:01:09 +0000 (12:01 +0000)
directories on DOS and Windows.

lisp/files.el

index 1a7ddb872cf2a4e6910a85278fcf052bf8264358..3c78f4ba099296061eaee7ba00f865fed166e153 100644 (file)
@@ -3560,8 +3560,20 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
                                   file))))))))
          (if (/= result 0)
              ;; We get here if `insert-directory-program' failed.
-             ;; Access the file to get a suitable error.
-             (access-file file "Reading directory")
+             ;; On non-Posix systems, we cannot open a directory, so
+             ;; don't even try, because that will always result in
+             ;; the ubiquitous "Access denied".  Instead, show them
+             ;; the `ls' command line and let them guess what went
+             ;; wrong.
+             (if (and (file-directory-p file)
+                      (memq system-type '(ms-dos windows-nt)))
+                 (error
+                  "Reading directory: \"%s %s -- %s\" exited with status %s"
+                  insert-directory-program
+                  (if (listp switches) (concat switches) switches)
+                  file result)
+               ;; Unix.  Access the file to get a suitable error.
+               (access-file file "Reading directory"))
            ;; Replace "total" with "used", to avoid confusion.
            ;; Add in the amount of free space.
            (save-excursion