diff src/fileio.c @ 108888:c2ac5cece5ea

Turn `directory-sep-char' into a noop. * lisp/subr.el (directory-sep-char): Move from fileio.c and make a defconst. * src/emacs.c (decode_env_path): Don't check DIRECTORY_SEP, call dostounix_filename directly. * src/fileio.c (CORRECT_DIR_SEPS): Remove. (Ffile_name_directory, directory_file_name, Fexpand_file_name) (Fsubstitute_in_file_name): Use dostounix_filename instead. (file_name_as_directory): Use dostounix_filename, DIRECTORY_SEP. (syms_of_fileio) <directory-sep-char>: Move to subr.el. * src/lisp.h [WINDOWSNT] (Vdirectory_sep_char): Don't declare. (DIRECTORY_SEP): Define unconditionally. * src/w32proc.c (CORRECT_DIR_SEPS): Remove. (Fw32_short_file_name, Fw32_long_file_name): Use dostounix_filename. * src/s/ms-w32.h (DIRECTORY_SEP): Remove.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 04 Jun 2010 16:13:35 +0200
parents 6515310887ec
children 2bc9a0c04c87
line wrap: on
line diff
--- a/src/fileio.c	Fri Jun 04 13:26:54 2010 +0200
+++ b/src/fileio.c	Fri Jun 04 16:13:35 2010 +0200
@@ -83,10 +83,6 @@
 #endif
 
 #ifdef DOS_NT
-#define CORRECT_DIR_SEPS(s) \
-  do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
-       else unixtodos_filename (s); \
-  } while (0)
 /* On Windows, drive letters must be alphabetic - on DOS, the Netware
    redirector allows the six letters between 'Z' and 'a' as well. */
 #ifdef MSDOS
@@ -474,7 +470,7 @@
 	  p = beg + strlen (beg);
 	}
     }
-  CORRECT_DIR_SEPS (beg);
+  dostounix_filename (beg);
 #endif /* DOS_NT */
 
   return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename));
@@ -561,12 +557,11 @@
   /* For Unix syntax, Append a slash if necessary */
   if (!IS_DIRECTORY_SEP (out[size]))
     {
-      /* Cannot use DIRECTORY_SEP, which could have any value */
-      out[size + 1] = '/';
+      out[size + 1] = DIRECTORY_SEP;
       out[size + 2] = '\0';
     }
 #ifdef DOS_NT
-  CORRECT_DIR_SEPS (out);
+  dostounix_filename (out);
 #endif
   return out;
 }
@@ -627,7 +622,7 @@
       )
     dst[slen - 1] = 0;
 #ifdef DOS_NT
-  CORRECT_DIR_SEPS (dst);
+  dostounix_filename (dst);
 #endif
   return 1;
 }
@@ -1032,10 +1027,9 @@
       if (!lose)
 	{
 #ifdef DOS_NT
-	  /* Make sure directories are all separated with / or \ as
-	     desired, but avoid allocation of a new string when not
-	     required. */
-	  CORRECT_DIR_SEPS (nm);
+	  /* Make sure directories are all separated with /, but
+	     avoid allocation of a new string when not required. */
+	  dostounix_filename (nm);
 #ifdef WINDOWSNT
 	  if (IS_DIRECTORY_SEP (nm[1]))
 	    {
@@ -1381,7 +1375,7 @@
 	target[0] = '/';
 	target[1] = ':';
       }
-    CORRECT_DIR_SEPS (target);
+    dostounix_filename (target);
 #endif /* DOS_NT */
 
     result = make_specified_string (target, -1, o - target, multibyte);
@@ -1659,7 +1653,7 @@
   bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
 
 #ifdef DOS_NT
-  CORRECT_DIR_SEPS (nm);
+  dostounix_filename (nm);
   substituted = (strcmp (nm, SDATA (filename)) != 0);
 #endif
   endp = nm + SBYTES (filename);
@@ -5787,11 +5781,6 @@
   Fput (Qfile_date_error, Qerror_message,
 	make_pure_c_string ("Cannot set file date"));
 
-  DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char,
-	       doc: /* Directory separator character for built-in functions that return file names.
-The value is always ?/.  Don't use this variable, just use `/'.  */);
-  XSETFASTINT (Vdirectory_sep_char, '/');
-
   DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist,
 	       doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially.
 If a file name matches REGEXP, then all I/O on that file is done by calling