tennis.map: Texture tweak
[neverball] / share / dir.h
1 #ifndef DIR_H
2 #define DIR_H
3
4 #include "array.h"
5 #include "list.h"
6
7 struct dir_item
8 {
9     const char *path;
10     void *data;
11 };
12
13 /*
14  * A minor convenience for quick member access, as in "DIR_ITEM_GET(a,
15  * i)->member".  Most of the time this macro is not what you want to
16  * use.
17  */
18 #define DIR_ITEM_GET(a, i) ((struct dir_item *) array_get((a), (i)))
19
20 Array dir_scan(const char *,
21                int  (*filter)    (struct dir_item *),
22                List (*list_files)(const char *),
23                void (*free_files)(List));
24 void  dir_free(Array);
25
26 List dir_list_files(const char *);
27 void dir_list_free (List);
28
29 int dir_exists(const char *);
30
31 #ifdef _WIN32
32 #include <direct.h>
33 #define dir_make(path) _mkdir(path)
34 #else
35 #include <sys/stat.h>
36 #define dir_make(path) mkdir(path, 0777)
37 #endif
38
39 #endif