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:
parent
01a8c191e2
commit
8c70e4a8c2
|
@ -1,14 +1,48 @@
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
void * FsReadFirst(const char * path, FsEntry * entry) {
|
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) {
|
int FsReadNext(void * search, FsEntry * entry) {
|
||||||
|
struct dirent * e;
|
||||||
|
|
||||||
|
e = readdir(search);
|
||||||
|
if (!e)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
strcpy(entry->cFileName, e->d_name);
|
||||||
|
strncpy(entry->cAlternateFileName, e->d_name, 12);
|
||||||
|
entry->flags = 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FsClose(void * search) {
|
void FsClose(void * search) {
|
||||||
|
DIR * dir = search;
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FsError(void) {
|
int FsError(void) {
|
||||||
|
|
Loading…
Reference in New Issue