summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el
index f37c23b7bdd..d20bb1401fa 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -740,9 +740,14 @@ The path separator is colon in GNU and GNU-like systems."
(error "No such directory found via CDPATH environment variable"))))
(defsubst directory-name-p (name)
- "Return non-nil if NAME ends with a slash character."
- (and (> (length name) 0)
- (char-equal (aref name (1- (length name))) ?/)))
+ "Return non-nil if NAME ends with a directory separator character."
+ (let ((len (length name))
+ (lastc ?.))
+ (if (> len 0)
+ (setq lastc (aref name (1- len))))
+ (or (= lastc ?/)
+ (and (memq system-type '(windows-nt ms-dos))
+ (= lastc ?\\)))))
(defun directory-files-recursively (dir regexp &optional include-directories)
"Return list of all files under DIR that have file names matching REGEXP.