VFS: Fix Windows build

This commit is contained in:
Jeffrey Pfau 2015-08-25 23:28:52 -07:00
parent 3f78362a3e
commit d747badc25
1 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@
#include "util/string.h"
#include <dirent.h>
#include <sys/stat.h>
static bool _vdClose(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 enum VFSType _vdeType(struct VDirEntry* vde);
struct VDirDE;
struct VDirEntryDE {
struct VDirEntry d;
struct VDirDE* p;
struct dirent* ent;
};
@ -50,6 +53,7 @@ struct VDir* VDirOpen(const char* path) {
vd->vde.d.name = _vdeName;
vd->vde.d.type = _vdeType;
vd->vde.p = vd;
return &vd->d;
}
@ -201,7 +205,7 @@ static enum VFSType _vdeType(struct VDirEntry* vde) {
}
return VFS_FILE;
#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));
sprintf(combined, "%s%s%s", dir, PATH_SEP, vdede->ent->d_name);
struct stat sb;