From bf7943066e1b52284bafe142626ff8c87609a0da Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 19 Dec 2001 19:00:44 +0000 Subject: [PATCH] (emacs_root_dir): New function. --- src/ChangeLog | 7 +++++++ src/msdos.c | 11 +++++++++++ src/w32.c | 15 +++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 019ec65ffd1..0acab8715f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2001-12-19 Eli Zaretskii + * w32.c (emacs_root_dir): New function. + + * msdos.c (emacs_root_dir): New function. + + * fileio.c (Fexpand_file_name) [DOS_NT]: Use the root directory + of the current drive as the fallback for default_directory. + * dired.c (file_name_completion): Run the elements of completion-ignored-extensions through ENCODE_FILE. diff --git a/src/msdos.c b/src/msdos.c index da39c9a99fa..168d3dfc88a 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */ #include /* for bzero and string functions */ #include /* for _fixpath */ #include /* for chdir, dup, dup2, etc. */ +#include /* for getdisk */ #if __DJGPP__ >= 2 #include #include /* for setmode */ @@ -4118,6 +4119,16 @@ getdefdir (drive, dst) return 1; } +char * +emacs_root_dir (void) +{ + static char root_dir[4]; + + sprintf (root_dir, "%c:/", 'A' + getdisk ()); + root_dir[0] = tolower (root_dir[0]); + return root_dir; +} + /* Remove all CR's that are followed by a LF. */ int diff --git a/src/w32.c b/src/w32.c index dbdd13d4d33..a8e4a5f37da 100644 --- a/src/w32.c +++ b/src/w32.c @@ -875,6 +875,21 @@ init_environment (char ** argv) init_user_info (); } +char * +emacs_root_dir (void) +{ + static char root_dir[FILENAME_MAX]; + const char *p; + + p = getenv ("emacs_dir"); + if (p == NULL) + abort (); + strcpy (root_dir, p); + root_dir[parse_root (root_dir, NULL)] = '\0'; + dostounix_filename (root_dir); + return root_dir; +} + /* We don't have scripts to automatically determine the system configuration for Emacs before it's compiled, and we don't want to have to make the user enter it, so we define EMACS_CONFIGURATION to invoke this runtime -- 2.39.2