changeset 42191:12131c06473a

(Fexpand_file_name) [DOS_NT]: Use the root directory of the current drive as the fallback for default_directory.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 19 Dec 2001 18:55:01 +0000
parents 5f88f0ddff2f
children bd23b0c564d9
files src/fileio.c
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Wed Dec 19 17:15:22 2001 +0000
+++ b/src/fileio.c	Wed Dec 19 18:55:01 2001 +0000
@@ -1038,7 +1038,23 @@
   if (NILP (default_directory))
     default_directory = current_buffer->directory;
   if (! STRINGP (default_directory))
-    default_directory = build_string ("/");
+    {
+#ifdef DOS_NT
+      /* "/" is not considered a root directory on DOS_NT, so using "/"
+	 here causes an infinite recursion in, e.g., the following:
+
+            (let (default-directory)
+	      (expand-file-name "a"))
+
+	 To avoid this, we set default_directory to the root of the
+	 current drive.  */
+      extern char *emacs_root_dir (void);
+
+      default_directory = build_string (emacs_root_dir ());
+#else
+      default_directory = build_string ("/");
+#endif
+    }
 
   if (!NILP (default_directory))
     {