-
- bool isdir = !!(gs_findDataStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
-
- if (isdir && !(flags & wxDIR))
- return wxFindNextFile();
- else if (!isdir && flags && !(flags & wxFILE))
- return wxFindNextFile();
-
- result += gs_findDataStruct.cFileName;
-
- return result;
-#else
- int flag = _A_NORMAL;
- if (flags & wxDIR) /* MATTHEW: [5] Use & */
- flag = _A_SUBDIR;
-
-#ifdef __BORLANDC__
- if (findfirst(WXSTRINGCAST spec, &gs_findDataStruct, flag) == 0)
-#else
- if (_dos_findfirst(WXSTRINGCAST spec, flag, &gs_findDataStruct) == 0)
-#endif
- {
- /* MATTHEW: [5] Check directory flag */
- char attrib;
-
-#ifdef __BORLANDC__
- attrib = gs_findDataStruct.ff_attrib;
-#else
- attrib = gs_findDataStruct.attrib;
-#endif
-
- if (attrib & _A_SUBDIR) {
- if (!(gs_findFlags & wxDIR))
- return wxFindNextFile();
- } else if (gs_findFlags && !(gs_findFlags & wxFILE))
- return wxFindNextFile();
-
- result +=
-#ifdef __BORLANDC__
- gs_findDataStruct.ff_name
-#else
- gs_findDataStruct.name
-#endif
- ;
- }
-#endif // __WIN32__
-
- return result;
-}
-
-wxString wxFindNextFile()
-{
- wxString result;
-
- // Find path only so we can concatenate found file onto path
- wxString path(wxPathOnly(gs_strFileSpec));
-
-try_again:
-
-#ifdef __WIN32__
- if (gs_hFileStruct == INVALID_HANDLE_VALUE)
- return result;
-
- bool success = (FindNextFile(gs_hFileStruct, &gs_findDataStruct) != 0);
- if (!success)
- {
- FindClose(gs_hFileStruct);
- gs_hFileStruct = INVALID_HANDLE_VALUE;
- }
- else
- {
- bool isdir = !!(gs_findDataStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
-
- if (isdir && !(gs_findFlags & wxDIR))
- goto try_again;
- else if (!isdir && gs_findFlags && !(gs_findFlags & wxFILE))
- goto try_again;
-
- if ( !path.IsEmpty() )
- result << path << wxT('\\');
- result << gs_findDataStruct.cFileName;
- }
-
- return result;
-#else // Win16
-
-#ifdef __BORLANDC__
- if (findnext(&gs_findDataStruct) == 0)
-#else
- if (_dos_findnext(&gs_findDataStruct) == 0)
-#endif
- {
- /* MATTHEW: [5] Check directory flag */
- char attrib;
-
-#ifdef __BORLANDC__
- attrib = gs_findDataStruct.ff_attrib;
-#else
- attrib = gs_findDataStruct.attrib;
-#endif
-
- if (attrib & _A_SUBDIR) {
- if (!(gs_findFlags & wxDIR))
- goto try_again;
- } else if (gs_findFlags && !(gs_findFlags & wxFILE))
- goto try_again;
-
-
- result +=
-#ifdef __BORLANDC__
- gs_findDataStruct.ff_name
-#else
- gs_findDataStruct.name
-#endif
- ;
- }
-#endif // Win32/16
-
- return result;