# HG changeset patch # User Eli Zaretskii # Date 1008788101 0 # Node ID 12131c06473a8f2107cec18bb0174bfecfd0ba86 # Parent 5f88f0ddff2fc934072272442cac076c50157e76 (Fexpand_file_name) [DOS_NT]: Use the root directory of the current drive as the fallback for default_directory. diff -r 5f88f0ddff2f -r 12131c06473a src/fileio.c --- 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)) {