changeset 6165:9ac91c745e60 draft

(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.
author Darkvater <Darkvater@openttd.org>
date Tue, 27 Feb 2007 16:05:49 +0000
parents aafa27437708
children a6dd37242b77
files src/win32.cpp
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -665,8 +665,11 @@
 		d = dir_calloc();
 		if (d != NULL) {
 			wchar_t search_path[MAX_PATH];
-			/* build search path for FindFirstFile */
-			_snwprintf(search_path, lengthof(search_path), L"%s\\*", path);
+			bool slash = path[wcslen(path) - 1] == L'\\';
+
+			/* 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';
 			d->hFind = FindFirstFileW(search_path, &d->fd);