(svn r8919) -Regression (UTF8) (try #2): Win9x is very picky about trailing slashes in paths, so C:\\* will not work (but C:\Windows\\* does; go figure). Thanks glx for pointing it out and for the initial fix.

This commit is contained in:
Darkvater 2007-02-27 16:05:49 +00:00
parent 9cbc0e4ade
commit c5e59b8a61

View File

@ -665,8 +665,11 @@ DIR *opendir(const wchar_t *path)
d = dir_calloc(); d = dir_calloc();
if (d != NULL) { if (d != NULL) {
wchar_t search_path[MAX_PATH]; wchar_t search_path[MAX_PATH];
/* build search path for FindFirstFile */ bool slash = path[wcslen(path) - 1] == L'\\';
_snwprintf(search_path, lengthof(search_path), L"%s\\*", path);
/* build search path for FindFirstFile, try not to append additional slashes
* as it throws Win9x off its groove for root directories */
_snwprintf(search_path, lengthof(search_path), L"%s%s*", path, slash ? L"" : L"\\");
*lastof(search_path) = '\0'; *lastof(search_path) = '\0';
d->hFind = FindFirstFileW(search_path, &d->fd); d->hFind = FindFirstFileW(search_path, &d->fd);