mirror of https://github.com/mgba-emu/mgba.git
VFS: Fix Windows build
This commit is contained in:
parent
3f78362a3e
commit
d747badc25
|
@ -8,6 +8,7 @@
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
static bool _vdClose(struct VDir* vd);
|
static bool _vdClose(struct VDir* vd);
|
||||||
static void _vdRewind(struct VDir* vd);
|
static void _vdRewind(struct VDir* vd);
|
||||||
|
@ -17,8 +18,10 @@ static struct VFile* _vdOpenFile(struct VDir* vd, const char* path, int mode);
|
||||||
static const char* _vdeName(struct VDirEntry* vde);
|
static const char* _vdeName(struct VDirEntry* vde);
|
||||||
static enum VFSType _vdeType(struct VDirEntry* vde);
|
static enum VFSType _vdeType(struct VDirEntry* vde);
|
||||||
|
|
||||||
|
struct VDirDE;
|
||||||
struct VDirEntryDE {
|
struct VDirEntryDE {
|
||||||
struct VDirEntry d;
|
struct VDirEntry d;
|
||||||
|
struct VDirDE* p;
|
||||||
struct dirent* ent;
|
struct dirent* ent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,6 +53,7 @@ struct VDir* VDirOpen(const char* path) {
|
||||||
|
|
||||||
vd->vde.d.name = _vdeName;
|
vd->vde.d.name = _vdeName;
|
||||||
vd->vde.d.type = _vdeType;
|
vd->vde.d.type = _vdeType;
|
||||||
|
vd->vde.p = vd;
|
||||||
|
|
||||||
return &vd->d;
|
return &vd->d;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +205,7 @@ static enum VFSType _vdeType(struct VDirEntry* vde) {
|
||||||
}
|
}
|
||||||
return VFS_FILE;
|
return VFS_FILE;
|
||||||
#else
|
#else
|
||||||
const char* dir = vdde->path;
|
const char* dir = vdede->p->path;
|
||||||
char* combined = malloc(sizeof(char) * (strlen(vdede->ent->d_name) + strlen(dir) + 2));
|
char* combined = malloc(sizeof(char) * (strlen(vdede->ent->d_name) + strlen(dir) + 2));
|
||||||
sprintf(combined, "%s%s%s", dir, PATH_SEP, vdede->ent->d_name);
|
sprintf(combined, "%s%s%s", dir, PATH_SEP, vdede->ent->d_name);
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
Loading…
Reference in New Issue