From: Richard M. Stallman Date: Sat, 9 Jul 1994 19:10:16 +0000 (+0000) Subject: (Ffile_name_directory, Ffile_name_nondirectory, X-Git-Tag: emacs-19.34~7668 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5a1cc0608d5ca7a36c4551425ebef3d30df15ca;p=emacs.git (Ffile_name_directory, Ffile_name_nondirectory, file_name_as_directory, directory_file_name, Fexpand_file_name, Ffile_name_absolute_p, Fsubstitute_in_file_name) [MSDOS]: Allow backslashed file names. --- diff --git a/src/fileio.c b/src/fileio.c index 1446eaf4033..7d907bc46d7 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -290,7 +290,7 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.") && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' #endif /* VMS */ #ifdef MSDOS - && p[-1] != ':' + && p[-1] != ':' && p[-1] != '\\' #endif ) p--; @@ -345,7 +345,7 @@ or the entire name if it contains no slash.") && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' #endif /* VMS */ #ifdef MSDOS - && p[-1] != ':' + && p[-1] != ':' && p[-1] != '\\' #endif ) p--; @@ -443,7 +443,7 @@ file_name_as_directory (out, in) #else /* not VMS */ /* For Unix syntax, Append a slash if necessary */ #ifdef MSDOS - if (out[size] != ':' && out[size] != '/') + if (out[size] != ':' && out[size] != '/' && out[size] != '\\') #else if (out[size] != '/') #endif @@ -623,9 +623,11 @@ directory_file_name (src, dst) But leave "/" unchanged; do not change it to "". */ strcpy (dst, src); if (slen > 1 - && dst[slen - 1] == '/' #ifdef MSDOS + && (dst[slen - 1] == '/' || dst[slen - 1] == '/') && dst[slen - 2] != ':' +#else + && dst[slen - 1] == '/' #endif ) dst[slen - 1] = 0; @@ -764,7 +766,10 @@ See also the function `substitute-in-file-name'.") nm = XSTRING (name)->data; #ifdef MSDOS - /* firstly, strip drive name. */ + /* First map all backslashes to slashes. */ + dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); + + /* Now strip drive name. */ { unsigned char *colon = rindex (nm, ':'); if (colon) @@ -1487,6 +1492,10 @@ duplicates what `expand-file-name' does.") CHECK_STRING (string, 0); nm = XSTRING (string)->data; +#ifdef MSDOS + dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); + substituted = !strcmp (nm, XSTRING (string)->data); +#endif endp = nm + XSTRING (string)->size; /* If /~ or // appears, discard everything through first slash. */ @@ -2139,7 +2148,7 @@ On Unix, this is a name starting with a `/' or a `~'.") && ptr[1] != '.') #endif /* VMS */ #ifdef MSDOS - || (*ptr != 0 && ptr[1] == ':' && ptr[2] == '/') + || (*ptr != 0 && ptr[1] == ':' && (ptr[2] == '/' || ptr[2] == '\\')) #endif ) return Qt;