[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/w32.c,v [EMACS_22_BASE]
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] Changes to emacs/src/w32.c,v [EMACS_22_BASE] |
Date: |
Wed, 26 Mar 2008 19:04:26 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Branch: EMACS_22_BASE
Changes by: Eli Zaretskii <eliz> 08/03/26 19:04:26
Index: w32.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32.c,v
retrieving revision 1.111.2.7
retrieving revision 1.111.2.8
diff -u -b -r1.111.2.7 -r1.111.2.8
--- w32.c 5 Feb 2008 02:30:41 -0000 1.111.2.7
+++ w32.c 26 Mar 2008 19:04:25 -0000 1.111.2.8
@@ -1779,6 +1779,8 @@
struct direct *
readdir (DIR *dirp)
{
+ int downcase = !NILP (Vw32_downcase_file_names);
+
if (wnet_enum_handle != INVALID_HANDLE_VALUE)
{
if (!read_unc_volume (wnet_enum_handle,
@@ -1816,11 +1818,23 @@
dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 +
dir_static.d_namlen - dir_static.d_namlen % 4;
- dir_static.d_namlen = strlen (dir_find_data.cFileName);
+ /* If the file name in cFileName[] includes `?' characters, it means
+ the original file name used characters that cannot be represented
+ by the current ANSI codepage. To avoid total lossage, retrieve
+ the short 8+3 alias of the long file name. */
+ if (_mbspbrk (dir_find_data.cFileName, "?"))
+ {
+ strcpy (dir_static.d_name, dir_find_data.cAlternateFileName);
+ /* 8+3 aliases are returned in all caps, which could break
+ various alists that look at filenames' extensions. */
+ downcase = 1;
+ }
+ else
strcpy (dir_static.d_name, dir_find_data.cFileName);
+ dir_static.d_namlen = strlen (dir_static.d_name);
if (dir_is_fat)
_strlwr (dir_static.d_name);
- else if (!NILP (Vw32_downcase_file_names))
+ else if (downcase)
{
register char *p;
for (p = dir_static.d_name; *p; p++)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/src/w32.c,v [EMACS_22_BASE],
Eli Zaretskii <=