diff options
| author | Eli Zaretskii | 2008-03-22 11:53:40 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-03-22 11:53:40 +0000 |
| commit | b07103dc2b17933e30e1500bce6f9a1471752cc7 (patch) | |
| tree | 339b5727183d646e5e0724c46724b0ca611bfe74 /src | |
| parent | 51ec3f09e45ca399c95108b6e486535012640743 (diff) | |
| download | emacs-b07103dc2b17933e30e1500bce6f9a1471752cc7.tar.gz emacs-b07103dc2b17933e30e1500bce6f9a1471752cc7.zip | |
(readdir): If FindFirstFile/FindNextFile return in cFileName a file name that
includes `?' characters, use the 8+3 alias in cAlternateFileName instead.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32.c | 19 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index da936e544db..7e010850b19 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-03-22 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (readdir): If FindFirstFile/FindNextFile return in | ||
| 4 | cFileName a file name that includes `?' characters, use the 8+3 | ||
| 5 | alias in cAlternateFileName instead. | ||
| 6 | |||
| 1 | 2008-03-21 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2008-03-21 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * buffer.c (enlarge_buffer_text): Fix int -> EMACS_INT. | 9 | * buffer.c (enlarge_buffer_text): Fix int -> EMACS_INT. |
| @@ -1889,6 +1889,8 @@ closedir (DIR *dirp) | |||
| 1889 | struct direct * | 1889 | struct direct * |
| 1890 | readdir (DIR *dirp) | 1890 | readdir (DIR *dirp) |
| 1891 | { | 1891 | { |
| 1892 | int downcase = !NILP (Vw32_downcase_file_names); | ||
| 1893 | |||
| 1892 | if (wnet_enum_handle != INVALID_HANDLE_VALUE) | 1894 | if (wnet_enum_handle != INVALID_HANDLE_VALUE) |
| 1893 | { | 1895 | { |
| 1894 | if (!read_unc_volume (wnet_enum_handle, | 1896 | if (!read_unc_volume (wnet_enum_handle, |
| @@ -1923,14 +1925,23 @@ readdir (DIR *dirp) | |||
| 1923 | value returned by stat(). */ | 1925 | value returned by stat(). */ |
| 1924 | dir_static.d_ino = 1; | 1926 | dir_static.d_ino = 1; |
| 1925 | 1927 | ||
| 1928 | strcpy (dir_static.d_name, dir_find_data.cFileName); | ||
| 1929 | |||
| 1930 | /* If the file name in cFileName[] includes `?' characters, it means | ||
| 1931 | the original file name used characters that cannot be represented | ||
| 1932 | by the current ANSI codepage. To avoid total lossage, retrieve | ||
| 1933 | the short 8+3 alias of the long file name. */ | ||
| 1934 | if (_mbspbrk (dir_static.d_name, "?")) | ||
| 1935 | { | ||
| 1936 | strcpy (dir_static.d_name, dir_find_data.cAlternateFileName); | ||
| 1937 | downcase = 1; /* 8+3 aliases are returned in all caps */ | ||
| 1938 | } | ||
| 1939 | dir_static.d_namlen = strlen (dir_static.d_name); | ||
| 1926 | dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 + | 1940 | dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 + |
| 1927 | dir_static.d_namlen - dir_static.d_namlen % 4; | 1941 | dir_static.d_namlen - dir_static.d_namlen % 4; |
| 1928 | |||
| 1929 | dir_static.d_namlen = strlen (dir_find_data.cFileName); | ||
| 1930 | strcpy (dir_static.d_name, dir_find_data.cFileName); | ||
| 1931 | if (dir_is_fat) | 1942 | if (dir_is_fat) |
| 1932 | _strlwr (dir_static.d_name); | 1943 | _strlwr (dir_static.d_name); |
| 1933 | else if (!NILP (Vw32_downcase_file_names)) | 1944 | else if (downcase) |
| 1934 | { | 1945 | { |
| 1935 | register char *p; | 1946 | register char *p; |
| 1936 | for (p = dir_static.d_name; *p; p++) | 1947 | for (p = dir_static.d_name; *p; p++) |