+ for ( ;; )
+ {
+ if ( !::FindNextFile(fd, finddata) )
+ return false;
+
+ // If we did find something, check that it really matches.
+ if ( CheckFoundMatch(finddata, filter) )
+ return true;
+ }
+}
+
+inline FIND_DATA
+FindFirst(const wxString& spec,
+ const wxString& filter,
+ FIND_STRUCT *finddata)
+{
+ FIND_DATA fd = ::FindFirstFile(spec.t_str(), finddata);
+
+ // As in FindNext() above, we need to check that the file name we found
+ // really matches our filter and look for the next match if it doesn't.
+ if ( IsFindDataOk(fd) && !CheckFoundMatch(finddata, filter) )
+ {
+ if ( !FindNext(fd, filter, finddata) )
+ {
+ // As we return the invalid handle from here to indicate that we
+ // didn't find anything, close the one we initially received
+ // ourselves.
+ FreeFindData(fd);
+
+ return INVALID_HANDLE_VALUE;
+ }
+ }
+
+ return fd;