changeset 42192:bd23b0c564d9

(emacs_root_dir): New function.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 19 Dec 2001 18:56:44 +0000
parents 12131c06473a
children e5cc759e1ee7
files src/msdos.c src/w32.c
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Wed Dec 19 18:55:01 2001 +0000
+++ b/src/msdos.c	Wed Dec 19 18:56:44 2001 +0000
@@ -38,6 +38,7 @@
 #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 @@
   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
--- a/src/w32.c	Wed Dec 19 18:55:01 2001 +0000
+++ b/src/w32.c	Wed Dec 19 18:56:44 2001 +0000
@@ -875,6 +875,21 @@
   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