Fixed Windows file finding.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 25 Feb 2014 14:10:15 -0500
changeset 1137 870fb459298d
parent 1136 0255ec8d7775
child 1138 119bbce82c8d
Fixed Windows file finding.
utils/finderrors.c
--- a/utils/finderrors.c	Tue Feb 25 14:05:12 2014 -0500
+++ b/utils/finderrors.c	Tue Feb 25 14:10:15 2014 -0500
@@ -156,9 +156,12 @@
     int total = 0;
 
 #ifdef _MSC_VER
-    WIN32_FIND_DATA dent;
-    HANDLE dirp = INVALID_HANDLE_VALUE;
-    FindFirstFileA(dname, &dent);
+	const size_t wildcardlen = strlen(dname) + 3;
+	char *wildcard = (char *) alloca(wildcardlen);
+	SDL_snprintf(wildcard, wildcardlen, "%s\\*", dname);
+
+    WIN32_FIND_DATAA dent;
+    HANDLE dirp = FindFirstFileA(wildcard, &dent);
     if (dirp != INVALID_HANDLE_VALUE)
     {
         do
@@ -166,7 +169,7 @@
             if (!do_file(profile, dname, dent.cFileName, &total))
                 break;
         } while (FindNextFileA(dirp, &dent) != 0);
-        CloseHandle(dirp);
+        FindClose(dirp);
     } // if
 #else
     struct dirent *dent = NULL;