summaryrefslogtreecommitdiff
path: root/firmware/include/dir.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/dir.h')
-rw-r--r--firmware/include/dir.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/firmware/include/dir.h b/firmware/include/dir.h
index 12ec724692..26ccd03ed3 100644
--- a/firmware/include/dir.h
+++ b/firmware/include/dir.h
@@ -30,6 +30,16 @@
30#define ATTR_ARCHIVE 0x20 30#define ATTR_ARCHIVE 0x20
31#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ 31#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
32 32
33#ifdef SIMULATOR
34#define dirent sim_dirent
35#define DIR SIM_DIR
36#define opendir(x) sim_opendir(x)
37#define readdir(x) sim_readdir(x)
38#define closedir(x) sim_closedir(x)
39#define mkdir(x, y) sim_mkdir(x, y)
40#define rmdir(x) sim_rmdir(x)
41#endif
42
33#ifndef DIRENT_DEFINED 43#ifndef DIRENT_DEFINED
34 44
35struct dirent { 45struct dirent {
@@ -42,12 +52,10 @@ struct dirent {
42}; 52};
43#endif 53#endif
44 54
45
46#ifndef SIMULATOR
47
48#include "fat.h" 55#include "fat.h"
49 56
50typedef struct { 57typedef struct {
58#ifndef SIMULATOR
51 bool busy; 59 bool busy;
52 int startcluster; 60 int startcluster;
53 struct fat_dir fatdir; 61 struct fat_dir fatdir;
@@ -56,25 +64,13 @@ typedef struct {
56#ifdef HAVE_MULTIVOLUME 64#ifdef HAVE_MULTIVOLUME
57 int volumecounter; /* running counter for faked volume entries */ 65 int volumecounter; /* running counter for faked volume entries */
58#endif 66#endif
67#else
68 /* simulator: */
69 void *dir; /* actually a DIR* dir */
70 char *name;
71#endif
59} DIR; 72} DIR;
60 73
61#else /* SIMULATOR */
62
63#ifdef WIN32
64#ifndef __MINGW32__
65#include <io.h>
66#endif /* __MINGW32__ */
67
68typedef struct DIRtag
69{
70 struct dirent fd;
71 int handle;
72} DIR;
73
74#endif /* WIN32 */
75
76#endif /* SIMULATOR */
77
78#ifndef DIRFUNCTIONS_DEFINED 74#ifndef DIRFUNCTIONS_DEFINED
79 75
80extern DIR* opendir(const char* name); 76extern DIR* opendir(const char* name);