* lisp/files.el (list-directory): Make sure 'default-directory' is
set to a valid value if the argument DIRNAME included wildcards.
(Bug#55877)
;; Finishing with-output-to-temp-buffer seems to clobber default-directory.
(with-current-buffer buffer
(setq default-directory
- (if (file-directory-p dirname)
+ (if (file-accessible-directory-p dirname)
(file-name-as-directory dirname)
- (file-name-directory dirname))))))
+ (file-name-directory (directory-file-name dirname)))))))
(defun shell-quote-wildcard-pattern (pattern)
"Quote characters special to the shell in PATTERN, leave wildcards alone.