This commit is contained in:
snarmph 2024-11-29 16:10:48 +01:00
parent 82aee127b0
commit a92b119549
99 changed files with 6922 additions and 5723 deletions

25
dir.h Normal file
View file

@ -0,0 +1,25 @@
#pragma once
#include "str.h"
#include "arena.h"
typedef struct dir_t dir_t;
typedef enum {
DIRTYPE_FILE,
DIRTYPE_DIR,
} dir_type_e;
typedef struct {
str_t name;
dir_type_e type;
usize filesize;
} dir_entry_t;
dir_t *dirOpen(arena_t *arena, strview_t path);
// optional, only call this if you want to return before dirNext returns NULL
void dirClose(dir_t *ctx);
bool dirIsValid(dir_t *ctx);
dir_entry_t *dirNext(arena_t *arena, dir_t *ctx);