summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-12-19 19:00:44 +0000
committerEli Zaretskii <eliz@gnu.org>2001-12-19 19:00:44 +0000
commitbf7943066e1b52284bafe142626ff8c87609a0da (patch)
treed39b23f4cf3411565c611917e0998e7b0e0bed92
parentdd693537fd33a3771cb4001373038c50529a3d85 (diff)
downloademacs-bf7943066e1b52284bafe142626ff8c87609a0da.tar.gz
(emacs_root_dir): New function.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/msdos.c11
-rw-r--r--src/w32.c15
3 files changed, 33 insertions, 0 deletions
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 <eliz@is.elta.co.il>
+ * 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 <string.h> /* for bzero and string functions */
#include <sys/stat.h> /* for _fixpath */
#include <unistd.h> /* for chdir, dup, dup2, etc. */
+#include <dir.h> /* for getdisk */
#if __DJGPP__ >= 2
#include <fcntl.h>
#include <io.h> /* 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