diff options
| author | Eli Zaretskii | 2001-12-19 18:55:01 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-12-19 18:55:01 +0000 |
| commit | dd693537fd33a3771cb4001373038c50529a3d85 (patch) | |
| tree | 5fa313d2535d647a9b05c65558ce898e0b5490e7 /src | |
| parent | 62582985a61162a99db1f451b30fbd4b5de726c0 (diff) | |
| download | emacs-dd693537fd33a3771cb4001373038c50529a3d85.tar.gz emacs-dd693537fd33a3771cb4001373038c50529a3d85.zip | |
(Fexpand_file_name) [DOS_NT]: Use the root directory
of the current drive as the fallback for default_directory.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 18 |
1 files changed, 17 insertions, 1 deletions
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'. */) | |||
| 1038 | if (NILP (default_directory)) | 1038 | if (NILP (default_directory)) |
| 1039 | default_directory = current_buffer->directory; | 1039 | default_directory = current_buffer->directory; |
| 1040 | if (! STRINGP (default_directory)) | 1040 | if (! STRINGP (default_directory)) |
| 1041 | default_directory = build_string ("/"); | 1041 | { |
| 1042 | #ifdef DOS_NT | ||
| 1043 | /* "/" is not considered a root directory on DOS_NT, so using "/" | ||
| 1044 | here causes an infinite recursion in, e.g., the following: | ||
| 1045 | |||
| 1046 | (let (default-directory) | ||
| 1047 | (expand-file-name "a")) | ||
| 1048 | |||
| 1049 | To avoid this, we set default_directory to the root of the | ||
| 1050 | current drive. */ | ||
| 1051 | extern char *emacs_root_dir (void); | ||
| 1052 | |||
| 1053 | default_directory = build_string (emacs_root_dir ()); | ||
| 1054 | #else | ||
| 1055 | default_directory = build_string ("/"); | ||
| 1056 | #endif | ||
| 1057 | } | ||
| 1042 | 1058 | ||
| 1043 | if (!NILP (default_directory)) | 1059 | if (!NILP (default_directory)) |
| 1044 | { | 1060 | { |