diff options
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/src/fileio.c b/src/fileio.c index 572f6d8ef83..442c66550d3 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -315,6 +315,7 @@ Given a Unix syntax file name, returns a string ending in slash. */) | |||
| 315 | register const char *beg; | 315 | register const char *beg; |
| 316 | #else | 316 | #else |
| 317 | register char *beg; | 317 | register char *beg; |
| 318 | Lisp_Object tem_fn; | ||
| 318 | #endif | 319 | #endif |
| 319 | register const char *p; | 320 | register const char *p; |
| 320 | Lisp_Object handler; | 321 | Lisp_Object handler; |
| @@ -374,10 +375,13 @@ Given a Unix syntax file name, returns a string ending in slash. */) | |||
| 374 | p = beg + strlen (beg); | 375 | p = beg + strlen (beg); |
| 375 | } | 376 | } |
| 376 | } | 377 | } |
| 377 | dostounix_filename (beg); | 378 | tem_fn = ENCODE_FILE (make_specified_string (beg, -1, p - beg, |
| 378 | #endif /* DOS_NT */ | 379 | STRING_MULTIBYTE (filename))); |
| 379 | 380 | dostounix_filename (SSDATA (tem_fn)); | |
| 381 | return DECODE_FILE (tem_fn); | ||
| 382 | #else /* DOS_NT */ | ||
| 380 | return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); | 383 | return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); |
| 384 | #endif /* DOS_NT */ | ||
| 381 | } | 385 | } |
| 382 | 386 | ||
| 383 | DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, | 387 | DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, |
| @@ -951,7 +955,18 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 951 | #ifdef DOS_NT | 955 | #ifdef DOS_NT |
| 952 | /* Make sure directories are all separated with /, but | 956 | /* Make sure directories are all separated with /, but |
| 953 | avoid allocation of a new string when not required. */ | 957 | avoid allocation of a new string when not required. */ |
| 954 | dostounix_filename (nm); | 958 | if (multibyte) |
| 959 | { | ||
| 960 | Lisp_Object tem_name = make_specified_string (nm, -1, strlen (nm), | ||
| 961 | multibyte); | ||
| 962 | |||
| 963 | tem_name = ENCODE_FILE (tem_name); | ||
| 964 | dostounix_filename (SSDATA (tem_name)); | ||
| 965 | tem_name = DECODE_FILE (tem_name); | ||
| 966 | memcpy (nm, SSDATA (tem_name), SBYTES (tem_name) + 1); | ||
| 967 | } | ||
| 968 | else | ||
| 969 | dostounix_filename (nm); | ||
| 955 | #ifdef WINDOWSNT | 970 | #ifdef WINDOWSNT |
| 956 | if (IS_DIRECTORY_SEP (nm[1])) | 971 | if (IS_DIRECTORY_SEP (nm[1])) |
| 957 | { | 972 | { |
| @@ -1133,7 +1148,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1133 | newdir = "/"; | 1148 | newdir = "/"; |
| 1134 | } | 1149 | } |
| 1135 | else | 1150 | else |
| 1136 | getwd (adir); | 1151 | getcwd (adir, MAXPATHLEN + 1); |
| 1137 | newdir = adir; | 1152 | newdir = adir; |
| 1138 | } | 1153 | } |
| 1139 | 1154 | ||
| @@ -1305,10 +1320,13 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1305 | target[0] = '/'; | 1320 | target[0] = '/'; |
| 1306 | target[1] = ':'; | 1321 | target[1] = ':'; |
| 1307 | } | 1322 | } |
| 1308 | dostounix_filename (target); | ||
| 1309 | #endif /* DOS_NT */ | ||
| 1310 | |||
| 1311 | result = make_specified_string (target, -1, o - target, multibyte); | 1323 | result = make_specified_string (target, -1, o - target, multibyte); |
| 1324 | result = ENCODE_FILE (result); | ||
| 1325 | dostounix_filename (SSDATA (result)); | ||
| 1326 | result = DECODE_FILE (result); | ||
| 1327 | #else /* !DOS_NT */ | ||
| 1328 | result = make_specified_string (target, -1, o - target, multibyte); | ||
| 1329 | #endif /* !DOS_NT */ | ||
| 1312 | } | 1330 | } |
| 1313 | 1331 | ||
| 1314 | /* Again look to see if the file name has special constructs in it | 1332 | /* Again look to see if the file name has special constructs in it |
| @@ -1587,8 +1605,18 @@ those `/' is discarded. */) | |||
| 1587 | memcpy (nm, SDATA (filename), SBYTES (filename) + 1); | 1605 | memcpy (nm, SDATA (filename), SBYTES (filename) + 1); |
| 1588 | 1606 | ||
| 1589 | #ifdef DOS_NT | 1607 | #ifdef DOS_NT |
| 1590 | dostounix_filename (nm); | 1608 | { |
| 1591 | substituted = (strcmp (nm, SDATA (filename)) != 0); | 1609 | Lisp_Object encoded_filename = ENCODE_FILE (filename); |
| 1610 | Lisp_Object tem_fn; | ||
| 1611 | |||
| 1612 | dostounix_filename (SDATA (encoded_filename)); | ||
| 1613 | tem_fn = DECODE_FILE (encoded_filename); | ||
| 1614 | nm = alloca (SBYTES (tem_fn) + 1); | ||
| 1615 | memcpy (nm, SDATA (tem_fn), SBYTES (tem_fn) + 1); | ||
| 1616 | substituted = (memcmp (nm, SDATA (filename), SBYTES (filename)) != 0); | ||
| 1617 | if (substituted) | ||
| 1618 | filename = tem_fn; | ||
| 1619 | } | ||
| 1592 | #endif | 1620 | #endif |
| 1593 | endp = nm + SBYTES (filename); | 1621 | endp = nm + SBYTES (filename); |
| 1594 | 1622 | ||