diff options
| author | Karl Heuer | 1995-04-12 02:06:22 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-04-12 02:06:22 +0000 |
| commit | 3c455a3b4ffed1a27f8e1fd4a83a303324d46b35 (patch) | |
| tree | 15eab94bdf023753c23e32f1dd9a12ab4dcea770 /src | |
| parent | ec2cfa3449c587fcb9a4f7a694d1763dde52eade (diff) | |
| download | emacs-3c455a3b4ffed1a27f8e1fd4a83a303324d46b35.tar.gz emacs-3c455a3b4ffed1a27f8e1fd4a83a303324d46b35.zip | |
(directory_file_name) [WINDOWSNT]: Handle UNC format.
(Fexpand_file_name) [DOS_NT]: Don't strip slash from default dirs like "C:\\"
Preserve drive letter case.
Fix syntax errors.
Check drive letter when expanding ~\.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/fileio.c b/src/fileio.c index c90e4c98e7d..1ba1a9e192c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -651,7 +651,7 @@ directory_file_name (src, dst) | |||
| 651 | strcpy (dst, src); | 651 | strcpy (dst, src); |
| 652 | if (slen > 1 | 652 | if (slen > 1 |
| 653 | && IS_DIRECTORY_SEP (dst[slen - 1]) | 653 | && IS_DIRECTORY_SEP (dst[slen - 1]) |
| 654 | && !IS_DEVICE_SEP (dst[slen - 2])) | 654 | && !IS_ANY_SEP (dst[slen - 2])) |
| 655 | dst[slen - 1] = 0; | 655 | dst[slen - 1] = 0; |
| 656 | return 1; | 656 | return 1; |
| 657 | } | 657 | } |
| @@ -813,12 +813,12 @@ See also the function `substitute-in-file-name'.") | |||
| 813 | nm++; | 813 | nm++; |
| 814 | else | 814 | else |
| 815 | { | 815 | { |
| 816 | drive = tolower (colon[-1]) - 'a'; | 816 | drive = colon[-1]; |
| 817 | nm = colon + 1; | 817 | nm = colon + 1; |
| 818 | if (!IS_DIRECTORY_SEP (*nm)) | 818 | if (!IS_DIRECTORY_SEP (*nm)) |
| 819 | { | 819 | { |
| 820 | defdir = alloca (MAXPATHLEN + 1); | 820 | defdir = alloca (MAXPATHLEN + 1); |
| 821 | relpath = getdefdir (drive + 1, defdir); | 821 | relpath = getdefdir (tolower (drive) - 'a' + 1), defdir); |
| 822 | } | 822 | } |
| 823 | } | 823 | } |
| 824 | } | 824 | } |
| @@ -977,6 +977,10 @@ See also the function `substitute-in-file-name'.") | |||
| 977 | if (!(newdir = (unsigned char *) egetenv ("HOME"))) | 977 | if (!(newdir = (unsigned char *) egetenv ("HOME"))) |
| 978 | newdir = (unsigned char *) ""; | 978 | newdir = (unsigned char *) ""; |
| 979 | #ifdef DOS_NT | 979 | #ifdef DOS_NT |
| 980 | /* Problem when expanding "~\" if HOME is not on current drive. | ||
| 981 | Ulrich Leodolter, Wed Jan 11 10:20:35 1995 */ | ||
| 982 | if (newdir[1] == ':') | ||
| 983 | drive = newdir[0]; | ||
| 980 | dostounix_filename (newdir); | 984 | dostounix_filename (newdir); |
| 981 | #endif | 985 | #endif |
| 982 | nm++; | 986 | nm++; |
| @@ -1039,7 +1043,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1039 | /* Adding `length > 1 &&' makes ~ expand into / when homedir | 1043 | /* Adding `length > 1 &&' makes ~ expand into / when homedir |
| 1040 | is the root dir. People disagree about whether that is right. | 1044 | is the root dir. People disagree about whether that is right. |
| 1041 | Anyway, we can't take the risk of this change now. */ | 1045 | Anyway, we can't take the risk of this change now. */ |
| 1042 | #ifdef MSDOS | 1046 | #ifdef DOS_NT |
| 1043 | if (newdir[1] != ':' && length > 1) | 1047 | if (newdir[1] != ':' && length > 1) |
| 1044 | #endif | 1048 | #endif |
| 1045 | if (IS_DIRECTORY_SEP (newdir[length - 1])) | 1049 | if (IS_DIRECTORY_SEP (newdir[length - 1])) |
| @@ -1135,10 +1139,11 @@ See also the function `substitute-in-file-name'.") | |||
| 1135 | { | 1139 | { |
| 1136 | *o++ = *p++; | 1140 | *o++ = *p++; |
| 1137 | } | 1141 | } |
| 1142 | else if ( | ||
| 1138 | #ifdef WINDOWSNT | 1143 | #ifdef WINDOWSNT |
| 1139 | else if (!strncmp (p, "\\\\", 2) || !strncmp (p, "//", 2)) | 1144 | (!strncmp (p, "\\\\", 2) || !strncmp (p, "//", 2)) |
| 1140 | #else /* not WINDOWSNT */ | 1145 | #else /* not WINDOWSNT */ |
| 1141 | else if (!strncmp (p, "//", 2) | 1146 | !strncmp (p, "//", 2) |
| 1142 | #endif /* not WINDOWSNT */ | 1147 | #endif /* not WINDOWSNT */ |
| 1143 | #ifdef APOLLO | 1148 | #ifdef APOLLO |
| 1144 | /* // at start of filename is meaningful in Apollo system */ | 1149 | /* // at start of filename is meaningful in Apollo system */ |
| @@ -1164,10 +1169,11 @@ See also the function `substitute-in-file-name'.") | |||
| 1164 | *o++ = *p; | 1169 | *o++ = *p; |
| 1165 | p += 2; | 1170 | p += 2; |
| 1166 | } | 1171 | } |
| 1172 | else if ( | ||
| 1167 | #ifdef WINDOWSNT | 1173 | #ifdef WINDOWSNT |
| 1168 | else if (!strncmp (p, "\\..", 3) || !strncmp (p, "/..", 3)) | 1174 | (!strncmp (p, "\\..", 3) || !strncmp (p, "/..", 3)) |
| 1169 | #else /* not WINDOWSNT */ | 1175 | #else /* not WINDOWSNT */ |
| 1170 | else if (!strncmp (p, "/..", 3) | 1176 | !strncmp (p, "/..", 3) |
| 1171 | #endif /* not WINDOWSNT */ | 1177 | #endif /* not WINDOWSNT */ |
| 1172 | /* `/../' is the "superroot" on certain file systems. */ | 1178 | /* `/../' is the "superroot" on certain file systems. */ |
| 1173 | && o != target | 1179 | && o != target |
| @@ -1207,7 +1213,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1207 | ) | 1213 | ) |
| 1208 | { | 1214 | { |
| 1209 | target -= 2; | 1215 | target -= 2; |
| 1210 | target[0] = (drive < 0 ? getdisk () : drive) + 'a'; | 1216 | target[0] = (drive < 0 ? getdisk () + 'A' : drive); |
| 1211 | target[1] = ':'; | 1217 | target[1] = ':'; |
| 1212 | } | 1218 | } |
| 1213 | #endif /* DOS_NT */ | 1219 | #endif /* DOS_NT */ |