- typedef struct ffblk FIND_STRUCT;
- #else
- #error "No directory searching functions for this compiler"
- #endif
-
- typedef FIND_STRUCT *FIND_DATA;
- typedef char FIND_ATTR;
-
- static inline FIND_DATA InitFindData() { return (FIND_DATA)NULL; }
- static inline bool IsFindDataOk(FIND_DATA fd) { return fd != NULL; }
- static inline void FreeFindData(FIND_DATA fd) { free(fd); }
-
- static inline FIND_DATA FindFirst(const wxString& spec,
- FIND_STRUCT * WXUNUSED(finddata))
- {
- // attribute to find all files
- static const FIND_ATTR attr = 0x3F;
-
- FIND_DATA fd = (FIND_DATA)malloc(sizeof(FIND_STRUCT));
-
- if (
- #ifdef __VISUALC__
- _dos_findfirst(spec, attr, fd) == 0
- #else // Borland
- findfirst(spec, fd, attr) == 0
- #endif
- )
- {
- return fd;
- }
- else
- {
- free(fd);
-
- return NULL;
- }
- }
-
- static inline bool FindNext(FIND_DATA fd, FIND_STRUCT * WXUNUSED(finddata))
- {
- #ifdef __VISUALC__
- return _dos_findnext(fd) == 0;
- #else // Borland
- return findnext(fd) == 0;
- #endif
- }
-
- static const wxChar *GetNameFromFindData(FIND_STRUCT *finddata)
- {
- #ifdef __VISUALC__
- return finddata->name;
- #else // Borland
- return finddata->ff_name;
- #endif
- }
-
- static const FIND_ATTR GetAttrFromFindData(FIND_STRUCT *finddata)
- {
- #ifdef __VISUALC__
- return finddata->attrib;
- #else // Borland
- return finddata->ff_attrib;
- #endif
- }
-
- static inline bool IsDir(FIND_ATTR attr)
- {
- return (attr & _A_SUBDIR) != 0;
- }
-
- static inline bool IsHidden(FIND_ATTR attr)
- {
- return (attr & (_A_SYSTEM | _A_HIDDEN)) != 0;
- }
-#else // Win32
- #include <windows.h>
-
- typedef WIN32_FIND_DATA FIND_STRUCT;
- typedef HANDLE FIND_DATA;
- typedef DWORD FIND_ATTR;
-
- static inline FIND_DATA InitFindData() { return INVALID_HANDLE_VALUE; }
-
- static inline bool IsFindDataOk(FIND_DATA fd)
- {