win32.c
branch0.5
changeset 5455 547cba149cbd
parent 5444 3209bb62403e
child 5466 85b7662d0342
--- a/win32.c	Tue Feb 27 15:51:52 2007 +0000
+++ b/win32.c	Tue Feb 27 16:23:02 2007 +0000
@@ -662,8 +662,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);