Added some code to fs-linux.c, it's now working enough to display files

but doesn't parse subdirs. The code needs some cleaning...
This commit is contained in:
yabause 2006-06-07 22:52:24 +00:00
parent 01a8c191e2
commit 8c70e4a8c2
1 changed files with 36 additions and 2 deletions

View File

@ -1,14 +1,48 @@
#include "fs.h"
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
void * FsReadFirst(const char * path, FsEntry * entry) {
return 0;
DIR * dir;
struct dirent * e;
printf("reading %s\n", path);
dir = opendir(path);
if (!dir)
return NULL;
e = readdir(dir);
if (!e)
return NULL;
strcpy(entry->cFileName, e->d_name);
strncpy(entry->cAlternateFileName, e->d_name, 12);
entry->flags = 0;
return dir;
}
int FsReadNext(void * search, FsEntry * entry) {
struct dirent * e;
e = readdir(search);
if (!e)
return 0;
strcpy(entry->cFileName, e->d_name);
strncpy(entry->cAlternateFileName, e->d_name, 12);
entry->flags = 0;
return 1;
}
void FsClose(void * search) {
DIR * dir = search;
closedir(dir);
}
int FsError(void) {