- if (wxMatchWild(name, nextDir->d_name))
- {
- result.Empty();
- if ( !path.IsEmpty() )
- {
- result = path;
- if ( path != '/' )
- result += '/';
- }
-
- result += nextDir->d_name;
-
- // Only return "." and ".." when they match
- bool isdir;
- if ( (strcmp(nextDir->d_name, ".") == 0) ||
- (strcmp(nextDir->d_name, "..") == 0))
- {
- if ( (gs_findFlags & wxDIR) != 0 )
- isdir = TRUE;
- else
- continue;
- }
- else
- isdir = wxDirExists(result);
-
- // and only return directories when flags & wxDIR
- if ( !gs_findFlags ||
- ((gs_findFlags & wxDIR) && isdir) ||
- ((gs_findFlags & wxFILE) && !isdir) )
- {
- return result;
- }
- }
- }
-
- result.Empty(); // not found
-
- closedir(gs_dirStream);
- gs_dirStream = (DIR *) NULL;
-#endif // !VMS
-
- return result;
-}
-
-#elif defined(__WXMSW__)
-
-#ifdef __WIN32__
- static HANDLE gs_hFileStruct = INVALID_HANDLE_VALUE;
- static WIN32_FIND_DATA gs_findDataStruct;
-#else // Win16
- #ifdef __BORLANDC__
- static struct ffblk gs_findDataStruct;
- #else
- static struct _find_t gs_findDataStruct;
- #endif // Borland
-#endif // Win32/16
-
-static wxString gs_strFileSpec;
-static int gs_findFlags = 0;
-
-wxString wxFindFirstFile(const char *spec, int flags)
-{
- wxString result;
-
- gs_strFileSpec = spec;
- gs_findFlags = flags; /* MATTHEW: [5] Remember flags */
-
- // Find path only so we can concatenate found file onto path
- wxString path(wxPathOnly(gs_strFileSpec));
- if ( !path.IsEmpty() )
- result << path << '\\';
-
-#ifdef __WIN32__
- if ( gs_hFileStruct != INVALID_HANDLE_VALUE )
- FindClose(gs_hFileStruct);
-
- gs_hFileStruct = ::FindFirstFile(WXSTRINGCAST spec, &gs_findDataStruct);
-
- if ( gs_hFileStruct == INVALID_HANDLE_VALUE )
- {
- result.Empty();
-