Skip to content

Commit

Permalink
Fixed Windows file finding.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 25, 2014
1 parent de08a84 commit 3c288b2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions utils/finderrors.c
Expand Up @@ -156,17 +156,20 @@ static int do_dir(const char *dname, const char *profile)
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
{
if (!do_file(profile, dname, dent.cFileName, &total))
break;
} while (FindNextFileA(dirp, &dent) != 0);
CloseHandle(dirp);
FindClose(dirp);
} // if
#else
struct dirent *dent = NULL;
Expand Down

0 comments on commit 3c288b2

Please sign in to comment.