From: Eli Zaretskii Date: Wed, 19 Dec 2001 18:55:01 +0000 (+0000) Subject: (Fexpand_file_name) [DOS_NT]: Use the root directory X-Git-Tag: ttn-vms-21-2-B4~17592 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dd693537fd33a3771cb4001373038c50529a3d85;p=emacs.git (Fexpand_file_name) [DOS_NT]: Use the root directory of the current drive as the fallback for default_directory. --- diff --git a/src/fileio.c b/src/fileio.c index 12d0c358ef5..ad2d210530d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1038,7 +1038,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)) {