diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-02-02 19:14:24 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-02-02 19:14:24 +0200 |
commit | e7ac588e198385a9bc5a2338000ab6db69c2353c (patch) | |
tree | e25696520b4cc48bdf537afb8e9497663bd187b4 /src/w32.c | |
parent | 85a83ea09dd2440187945ed4bb5f3f6fcebb9a71 (diff) | |
download | emacs-e7ac588e198385a9bc5a2338000ab6db69c2353c.tar.gz |
Avoid encoding file names run through dostounix_filename on MS-Windows.
src/w32.c (normalize_filename): Accept an additional argument
MULTIBYTE; if non-zero, traverse the file name by bytes and don't
downcase it even if w32-downcase-file-names is non-nil.
(dostounix_filename): Accept an additional argument MULTIBYTE and
pass it to normalize_filename.
(emacs_root_dir): Adjust.
src/msdos.h (dostounix_filename): Adjust prototype.
src/w32.h (dostounix_filename): Adjust prototype.
src/msdos.c (dostounix_filename): Accept an additional argument and
ignore it.
(init_environment): Adjust callers of dostounix_filename.
src/fileio.c (Ffile_name_directory, file_name_as_directory)
(directory_file_name, Fexpand_file_name)
(Fsubstitute_in_file_name): [DOS_NT] Adjust call to
dostounix_filename.
[WINDOWSNT]: Downcase file names if w32-downcase-file-names is
non-nil.
(Fsubstitute_in_file_name): [DOS_NT] Don't downcase environment
variables, as egetenv is case-insensitive for DOS_NT.
src/dired.c (file_name_completion): Don't call Fdirectory_file_name
with an encoded file name.
src/w32proc.c (Fw32_short_file_name, Fw32_long_file_name): Adjust
calls to dostounix_filename.
src/w32fns.c (Fx_file_dialog): Adjust call to dostounix_filename.
src/unexw32.c (unexec): Adjust call to dostounix_filename.
src/termcap.c (tgetent) [MSDOS]: Adjust call to dostounix_filename.
src/emacs.c (decode_env_path) [DOS_NT]: Adjust call to
dostounix_filename.
src/callproc.c (Fcall_process) [MSDOS]: Adjust call to
dostounix_filename.
Diffstat (limited to 'src/w32.c')
-rw-r--r-- | src/w32.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/w32.c b/src/w32.c index 64e989a3b36..8b89bd3e660 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1598,12 +1598,17 @@ max_filename_mbslen (void) case path name components to lower case. */ static void -normalize_filename (register char *fp, char path_sep) +normalize_filename (register char *fp, char path_sep, int multibyte) { char sep; char *elem, *p2; int dbcs_p = max_filename_mbslen () > 1; + /* Multibyte file names are in the Emacs internal representation, so + we can traverse them by bytes with no problems. */ + if (multibyte) + dbcs_p = 0; + /* Always lower-case drive letters a-z, even if the filesystem preserves case in filenames. This is so filenames can be compared by string comparison @@ -1620,7 +1625,7 @@ normalize_filename (register char *fp, char path_sep) fp += 2; } - if (NILP (Vw32_downcase_file_names)) + if (multibyte || NILP (Vw32_downcase_file_names)) { while (*fp) { @@ -1668,18 +1673,20 @@ normalize_filename (register char *fp, char path_sep) } while (*fp); } -/* Destructively turn backslashes into slashes. */ +/* Destructively turn backslashes into slashes. MULTIBYTE non-zero + means the file name is a multibyte string in Emacs's internal + representation. */ void -dostounix_filename (register char *p) +dostounix_filename (register char *p, int multibyte) { - normalize_filename (p, '/'); + normalize_filename (p, '/', multibyte); } /* Destructively turn slashes into backslashes. */ void unixtodos_filename (register char *p) { - normalize_filename (p, '\\'); + normalize_filename (p, '\\', 0); } /* Remove all CR's that are followed by a LF. @@ -2222,7 +2229,7 @@ emacs_root_dir (void) emacs_abort (); strcpy (root_dir, p); root_dir[parse_root (root_dir, NULL)] = '\0'; - dostounix_filename (root_dir); + dostounix_filename (root_dir, 0); return root_dir; } |