aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/w32.c b/src/w32.c
index 64f8a0335ac..8b89bd3e660 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1598,12 +1598,17 @@ max_filename_mbslen (void)
1598 case path name components to lower case. */ 1598 case path name components to lower case. */
1599 1599
1600static void 1600static void
1601normalize_filename (register char *fp, char path_sep) 1601normalize_filename (register char *fp, char path_sep, int multibyte)
1602{ 1602{
1603 char sep; 1603 char sep;
1604 char *elem, *p2; 1604 char *elem, *p2;
1605 int dbcs_p = max_filename_mbslen () > 1; 1605 int dbcs_p = max_filename_mbslen () > 1;
1606 1606
1607 /* Multibyte file names are in the Emacs internal representation, so
1608 we can traverse them by bytes with no problems. */
1609 if (multibyte)
1610 dbcs_p = 0;
1611
1607 /* Always lower-case drive letters a-z, even if the filesystem 1612 /* Always lower-case drive letters a-z, even if the filesystem
1608 preserves case in filenames. 1613 preserves case in filenames.
1609 This is so filenames can be compared by string comparison 1614 This is so filenames can be compared by string comparison
@@ -1620,7 +1625,7 @@ normalize_filename (register char *fp, char path_sep)
1620 fp += 2; 1625 fp += 2;
1621 } 1626 }
1622 1627
1623 if (NILP (Vw32_downcase_file_names)) 1628 if (multibyte || NILP (Vw32_downcase_file_names))
1624 { 1629 {
1625 while (*fp) 1630 while (*fp)
1626 { 1631 {
@@ -1668,18 +1673,20 @@ normalize_filename (register char *fp, char path_sep)
1668 } while (*fp); 1673 } while (*fp);
1669} 1674}
1670 1675
1671/* Destructively turn backslashes into slashes. */ 1676/* Destructively turn backslashes into slashes. MULTIBYTE non-zero
1677 means the file name is a multibyte string in Emacs's internal
1678 representation. */
1672void 1679void
1673dostounix_filename (register char *p) 1680dostounix_filename (register char *p, int multibyte)
1674{ 1681{
1675 normalize_filename (p, '/'); 1682 normalize_filename (p, '/', multibyte);
1676} 1683}
1677 1684
1678/* Destructively turn slashes into backslashes. */ 1685/* Destructively turn slashes into backslashes. */
1679void 1686void
1680unixtodos_filename (register char *p) 1687unixtodos_filename (register char *p)
1681{ 1688{
1682 normalize_filename (p, '\\'); 1689 normalize_filename (p, '\\', 0);
1683} 1690}
1684 1691
1685/* Remove all CR's that are followed by a LF. 1692/* Remove all CR's that are followed by a LF.
@@ -2222,7 +2229,7 @@ emacs_root_dir (void)
2222 emacs_abort (); 2229 emacs_abort ();
2223 strcpy (root_dir, p); 2230 strcpy (root_dir, p);
2224 root_dir[parse_root (root_dir, NULL)] = '\0'; 2231 root_dir[parse_root (root_dir, NULL)] = '\0';
2225 dostounix_filename (root_dir); 2232 dostounix_filename (root_dir, 0);
2226 return root_dir; 2233 return root_dir;
2227} 2234}
2228 2235
@@ -4280,7 +4287,7 @@ fstatat (int fd, char const *name, struct stat *st, int flags)
4280 /* Rely on a hack: an open directory is modeled as file descriptor 0. 4287 /* Rely on a hack: an open directory is modeled as file descriptor 0.
4281 This is good enough for the current usage in Emacs, but is fragile. 4288 This is good enough for the current usage in Emacs, but is fragile.
4282 4289
4283 FIXME: Add proper support for fdopendir, fstatatat, readlinkat. 4290 FIXME: Add proper support for fdopendir, fstatat, readlinkat.
4284 Gnulib does this and can serve as a model. */ 4291 Gnulib does this and can serve as a model. */
4285 char fullname[MAX_PATH]; 4292 char fullname[MAX_PATH];
4286 4293