added some utility functions + fixed error in ostrAppendview
This commit is contained in:
parent
aa39e2563d
commit
be71719f73
7 changed files with 47 additions and 18 deletions
18
dir.c
18
dir.c
|
|
@ -81,6 +81,15 @@ dir_t dirOpen(const char *path) {
|
|||
return dir;
|
||||
}
|
||||
|
||||
void dirClose(dir_t ctx) {
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
bool dirValid(dir_t ctx) {
|
||||
_dir_internal_t *dir = (_dir_internal_t*)ctx;
|
||||
return dir->handle != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
dir_entry_t *dirNext(dir_t ctx) {
|
||||
_dir_internal_t *dir = (_dir_internal_t*)ctx;
|
||||
strFree(&dir->cur.name);
|
||||
|
|
@ -90,10 +99,6 @@ dir_entry_t *dirNext(dir_t ctx) {
|
|||
return &dir->cur;
|
||||
}
|
||||
|
||||
void dirClose(dir_t ctx) {
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <dirent.h>
|
||||
|
|
@ -127,6 +132,11 @@ void dirClose(dir_t ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
bool dirValid(dir_t ctx) {
|
||||
_dir_internal_t *dir = (_dir_internal_t*)ctx;
|
||||
return dir->handle != NULL;
|
||||
}
|
||||
|
||||
dir_entry_t *dirNext(dir_t ctx) {
|
||||
if(!ctx) return NULL;
|
||||
_dir_internal_t *in = (_dir_internal_t *)ctx;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue