changeset 1230:f882f7a19c60

(file-relative-name): Don't lose when DIRECTORY is nil.
author Roland McGrath <roland@gnu.org>
date Sun, 27 Sep 1992 02:27:00 +0000
parents d4324e885a41
children f1090e965244
files lisp/files.el
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sun Sep 27 02:25:31 1992 +0000
+++ b/lisp/files.el	Sun Sep 27 02:27:00 1992 +0000
@@ -940,7 +940,8 @@
 (defun file-relative-name (filename &optional directory)
   "Convert FILENAME to be relative to DIRECTORY (default: default-directory)."
   (setq filename (expand-file-name filename)
-	directory (file-name-as-directory (or (expand-file-name directory)
+	directory (file-name-as-directory (if directory
+					      (expand-file-name directory)
 					      default-directory)))
   (while (not (string-match (concat "^" (regexp-quote directory)) filename))
     (setq directory (file-name-directory (substring directory 0 -1))))