win32.c
branch0.5
changeset 5444 3209bb62403e
parent 5428 ef4e98d1a511
child 5455 547cba149cbd
--- a/win32.c	Sat Feb 24 01:14:54 2007 +0000
+++ b/win32.c	Sat Feb 24 01:21:31 2007 +0000
@@ -652,19 +652,20 @@
 	}
 }
 
-DIR *opendir(const char *path)
+DIR *opendir(const wchar_t *path)
 {
 	DIR *d;
 	UINT sem = SetErrorMode(SEM_FAILCRITICALERRORS); // disable 'no-disk' message box
-	DWORD fa = GetFileAttributesW(OTTD2FS(path));
+	DWORD fa = GetFileAttributesW(path);
 
 	if ((fa != INVALID_FILE_ATTRIBUTES) && (fa & FILE_ATTRIBUTE_DIRECTORY)) {
 		d = dir_calloc();
 		if (d != NULL) {
-			char search_path[MAX_PATH];
+			wchar_t search_path[MAX_PATH];
 			/* build search path for FindFirstFile */
-			snprintf(search_path, lengthof(search_path), "%s" PATHSEP "*", path);
-			d->hFind = FindFirstFileW(OTTD2FS(search_path), &d->fd);
+			_snwprintf(search_path, lengthof(search_path), L"%s\\*", path);
+			*lastof(search_path) = '\0';
+			d->hFind = FindFirstFileW(search_path, &d->fd);
 
 			if (d->hFind != INVALID_HANDLE_VALUE ||
 					GetLastError() == ERROR_NO_MORE_FILES) { // the directory is empty