]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fexpand_file_name) [DOS_NT]: Use the root directory
authorRichard M. Stallman <rms@gnu.org>
Mon, 29 Jul 2002 01:29:02 +0000 (01:29 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 29 Jul 2002 01:29:02 +0000 (01:29 +0000)
of the current drive as the fallback for default_directory.

src/fileio.c

index 6326f70ed3392d2ec724344a5f761ea5beeb53da..152364a6e82d72885ddc2fe2e9b2ea0392b81e31 100644 (file)
@@ -1034,7 +1034,23 @@ See also the function `substitute-in-file-name'.")
   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))
     {