diff options
author | Darkvater <darkvater@openttd.org> | 2006-08-04 23:41:13 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-08-04 23:41:13 +0000 |
commit | 4de30befaee2141e410bf0df5d5f7e3906bc0111 (patch) | |
tree | eafaa93a2d76a24ddd843e6f53f8e4c870a82afb /fios.h | |
parent | bca8e9ad4ea5cb0d9e20ff0432333ab5bc89b612 (diff) | |
download | openttd-4de30befaee2141e410bf0df5d5f7e3906bc0111.tar.xz |
(svn r5762) - Codechange: Implementation of POSIX-style opendir/readdir/closedir functions for windows using FindFirstFile/FindNextFile/FindClose.
- Add new header file fios.h that will be the place for all FIOS (game-list) types.
Diffstat (limited to 'fios.h')
-rw-r--r-- | fios.h | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -0,0 +1,38 @@ +/* $Id$ */ + +#ifndef FIOS_H +#define FIOS_H + +/* Implementation of opendir/readdir/closedir for Windows */ +#if defined(WIN32) +#include <windows.h> +typedef struct DIR DIR; + +typedef struct dirent { // XXX - only d_name implemented + char *d_name; /* name of found file */ + /* little hack which will point to parent DIR struct which will + * save us a call to GetFileAttributes if we want information + * about the file (for example in function fio_bla */ + DIR *dir; +} dirent; + +struct DIR { + HANDLE hFind; + /* the dirent returned by readdir. + * note: having only one global instance is not possible because + * multiple independent opendir/readdir sequences must be supported. */ + dirent ent; + WIN32_FIND_DATA fd; + /* since opendir calls FindFirstFile, we need a means of telling the + * first call to readdir that we already have a file. + * that's the case iff this is true */ + bool at_first_entry; +}; + +DIR *opendir(const char *path); +struct dirent *readdir(DIR *d); +int closedir(DIR *d); + +#endif /* defined(WIN32) */ + +#endif /* FIOS_H */ |