twn_util.c: add file_read()
This commit is contained in:
@ -154,6 +154,24 @@ char *file_to_str(const char *path) {
|
||||
return str_out;
|
||||
}
|
||||
|
||||
static char **read_files;
|
||||
|
||||
char const *file_read(char const *file) {
|
||||
char *s = file_to_str(file);
|
||||
|
||||
if (s) arrpush(read_files, s);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
void file_read_garbage_collect(void) {
|
||||
for (size_t i = 0; i < arrlenu(read_files); ++i)
|
||||
SDL_free(read_files[i]);
|
||||
arrfree(read_files);
|
||||
read_files = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool file_exists(const char *path) {
|
||||
return PHYSFS_exists(path);
|
||||
|
Reference in New Issue
Block a user