[FL-2414, FL-2417] Archive: Unlimited file list and various fixes (#1089)

* Archive: unlimited file list and various fixes
* Recursive remove fix
This commit is contained in:
Nikolay Minaylov
2022-04-06 20:44:06 +03:00
committed by GitHub
parent 5a8961764e
commit b43dcbd74f
10 changed files with 322 additions and 134 deletions

View File

@@ -39,6 +39,8 @@ bool archive_app_read_dir(void* context, const char* path) {
furi_assert(path);
ArchiveBrowserView* browser = context;
archive_file_array_rm_all(browser);
ArchiveAppTypeEnum app = archive_get_app_type(path);
if(app == ArchiveAppTypeU2f) {

View File

@@ -3,25 +3,31 @@
#include "archive_browser.h"
#include <math.h>
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx) {
size_t array_size = files_array_size(model->files);
if((idx >= model->array_offset + array_size) || (idx < model->array_offset)) {
return false;
}
return true;
}
void archive_update_offset(ArchiveBrowserView* browser) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
size_t array_size = files_array_size(model->files);
uint16_t bounds = array_size > 3 ? 2 : array_size;
uint16_t bounds = model->item_cnt > 3 ? 2 : model->item_cnt;
if(array_size > 3 && model->idx >= array_size - 1) {
model->list_offset = model->idx - 3;
} else if(
model->last_offset && model->last_offset != model->list_offset &&
model->tab_idx == model->last_tab) {
model->list_offset = model->last_offset;
model->last_offset = !model->last_offset;
} else if(model->list_offset < model->idx - bounds) {
model->list_offset = CLAMP(model->idx - 2, array_size - bounds, 0);
} else if(model->list_offset > model->idx - bounds) {
model->list_offset = CLAMP(model->idx - 1, array_size - bounds, 0);
if(model->item_cnt > 3 && model->item_idx >= model->item_cnt - 1) {
model->list_offset = model->item_idx - 3;
} else if(model->list_offset < model->item_idx - bounds) {
model->list_offset = CLAMP(model->item_idx - 2, model->item_cnt - bounds, 0);
} else if(model->list_offset > model->item_idx - bounds) {
model->list_offset = CLAMP(model->item_idx - 1, model->item_cnt - bounds, 0);
}
return true;
});
}
@@ -32,8 +38,8 @@ void archive_update_focus(ArchiveBrowserView* browser, const char* target) {
archive_get_filenames(browser, string_get_cstr(browser->path));
if(!archive_file_array_size(browser) && !archive_get_depth(browser)) {
archive_switch_tab(browser, DEFAULT_TAB_DIR);
if(!archive_file_get_array_size(browser) && !archive_get_depth(browser)) {
archive_switch_tab(browser, TAB_RIGHT);
} else {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
@@ -41,7 +47,7 @@ void archive_update_focus(ArchiveBrowserView* browser, const char* target) {
while(idx < files_array_size(model->files)) {
ArchiveFile_t* current = files_array_get(model->files, idx);
if(!string_search(current->name, target)) {
model->idx = idx;
model->item_idx = idx + model->array_offset;
break;
}
++idx;
@@ -53,7 +59,9 @@ void archive_update_focus(ArchiveBrowserView* browser, const char* target) {
}
}
size_t archive_file_array_size(ArchiveBrowserView* browser) {
size_t archive_file_get_array_size(ArchiveBrowserView* browser) {
furi_assert(browser);
uint16_t size = 0;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
@@ -63,40 +71,60 @@ size_t archive_file_array_size(ArchiveBrowserView* browser) {
return size;
}
void archive_file_array_rm_selected(ArchiveBrowserView* browser) {
void archive_set_item_count(ArchiveBrowserView* browser, uint32_t count) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
files_array_remove_v(model->files, model->idx, model->idx + 1);
model->idx = CLAMP(model->idx, files_array_size(model->files) - 1, 0);
model->item_cnt = count;
return false;
});
}
void archive_file_array_rm_selected(ArchiveBrowserView* browser) {
furi_assert(browser);
uint32_t items_cnt = 0;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
files_array_remove_v(
model->files,
model->item_idx - model->array_offset,
model->item_idx - model->array_offset + 1);
model->item_cnt--;
model->item_idx = CLAMP(model->item_idx, model->item_cnt - 1, 0);
items_cnt = model->item_cnt;
return false;
});
if(!archive_file_array_size(browser) && !archive_get_depth(browser)) {
archive_switch_tab(browser, DEFAULT_TAB_DIR);
if((items_cnt == 0) && (archive_get_depth(browser) == 0)) {
archive_switch_tab(browser, TAB_RIGHT);
}
archive_update_offset(browser);
}
void archive_file_array_swap(ArchiveBrowserView* browser, int8_t d) {
void archive_file_array_swap(ArchiveBrowserView* browser, int8_t dir) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
ArchiveFile_t temp;
size_t array_size = files_array_size(model->files) - 1;
uint8_t swap_idx = CLAMP(model->idx + d, array_size, 0);
uint8_t swap_idx = CLAMP(model->item_idx + dir, array_size, 0);
if(model->idx == 0 && d < 0) {
if(model->item_idx == 0 && dir < 0) {
ArchiveFile_t_init(&temp);
files_array_pop_at(&temp, model->files, array_size);
files_array_push_at(model->files, model->idx, temp);
files_array_push_at(model->files, model->item_idx, temp);
ArchiveFile_t_clear(&temp);
} else if(model->idx == array_size && d > 0) {
} else if(model->item_idx == array_size && dir > 0) {
ArchiveFile_t_init(&temp);
files_array_pop_at(&temp, model->files, model->last_idx);
files_array_pop_at(&temp, model->files, model->item_idx);
files_array_push_at(model->files, array_size, temp);
ArchiveFile_t_clear(&temp);
} else {
files_array_swap_at(model->files, model->idx, swap_idx);
files_array_swap_at(model->files, model->item_idx, swap_idx);
}
return false;
@@ -104,6 +132,8 @@ void archive_file_array_swap(ArchiveBrowserView* browser, int8_t d) {
}
void archive_file_array_rm_all(ArchiveBrowserView* browser) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
files_array_reset(model->files);
@@ -111,23 +141,61 @@ void archive_file_array_rm_all(ArchiveBrowserView* browser) {
});
}
bool archive_file_array_load(ArchiveBrowserView* browser, int8_t dir) {
furi_assert(browser);
int32_t offset_new = 0;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
if(model->item_cnt > FILE_LIST_BUF_LEN) {
if(dir < 0) {
offset_new = model->item_idx - FILE_LIST_BUF_LEN / 4 * 3;
} else if(dir == 0) {
offset_new = model->item_idx - FILE_LIST_BUF_LEN / 4 * 2;
} else {
offset_new = model->item_idx - FILE_LIST_BUF_LEN / 4 * 1;
}
offset_new = CLAMP(offset_new, model->item_cnt - FILE_LIST_BUF_LEN, 0);
}
return false;
});
bool res = archive_dir_read_items(
browser, string_get_cstr(browser->path), offset_new, FILE_LIST_BUF_LEN);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->array_offset = offset_new;
model->list_loading = false;
return true;
});
return res;
}
ArchiveFile_t* archive_get_current_file(ArchiveBrowserView* browser) {
furi_assert(browser);
ArchiveFile_t* selected;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
selected = files_array_size(model->files) ? files_array_get(model->files, model->idx) :
NULL;
selected = files_array_size(model->files) ?
files_array_get(model->files, model->item_idx - model->array_offset) :
NULL;
return false;
});
return selected;
}
ArchiveFile_t* archive_get_file_at(ArchiveBrowserView* browser, size_t idx) {
furi_assert(browser);
ArchiveFile_t* selected;
idx = CLAMP(idx, archive_file_array_size(browser), 0);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
idx = CLAMP(idx - model->array_offset, files_array_size(model->files), 0);
selected = files_array_size(model->files) ? files_array_get(model->files, idx) : NULL;
return false;
});
@@ -135,6 +203,8 @@ ArchiveFile_t* archive_get_file_at(ArchiveBrowserView* browser, size_t idx) {
}
ArchiveTabEnum archive_get_tab(ArchiveBrowserView* browser) {
furi_assert(browser);
ArchiveTabEnum tab_id;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
@@ -145,10 +215,12 @@ ArchiveTabEnum archive_get_tab(ArchiveBrowserView* browser) {
}
uint8_t archive_get_depth(ArchiveBrowserView* browser) {
furi_assert(browser);
uint8_t depth;
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
depth = model->depth;
depth = idx_last_array_size(model->idx_last);
return false;
});
@@ -165,6 +237,8 @@ const char* archive_get_name(ArchiveBrowserView* browser) {
}
void archive_set_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->tab_idx = tab;
@@ -172,6 +246,8 @@ void archive_set_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
});
}
void archive_set_last_tab(ArchiveBrowserView* browser, ArchiveTabEnum tab) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->last_tab = model->tab_idx;
@@ -198,11 +274,12 @@ void archive_add_app_item(ArchiveBrowserView* browser, const char* name) {
ArchiveFile_t_init(&item);
string_init_set_str(item.name, name);
set_file_type(&item, NULL, app_name + 1, true);
archive_set_file_type(&item, NULL, app_name + 1, true);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
files_array_push_back(model->files, item);
model->item_cnt = files_array_size(model->files);
return false;
});
ArchiveFile_t_clear(&item);
@@ -216,10 +293,11 @@ void archive_add_file_item(ArchiveBrowserView* browser, FileInfo* file_info, con
ArchiveFile_t item;
if(filter_by_extension(file_info, archive_get_tab_ext(archive_get_tab(browser)), name)) {
if(archive_filter_by_extension(
file_info, archive_get_tab_ext(archive_get_tab(browser)), name)) {
ArchiveFile_t_init(&item);
string_init_set_str(item.name, name);
set_file_type(&item, file_info, archive_get_path(browser), false);
archive_set_file_type(&item, file_info, archive_get_path(browser), false);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
@@ -234,12 +312,17 @@ void archive_show_file_menu(ArchiveBrowserView* browser, bool show) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->menu = show;
model->menu_idx = 0;
if(show) {
ArchiveFile_t* selected = files_array_get(model->files, model->idx);
selected->fav = archive_is_favorite("%s", string_get_cstr(selected->name));
if(archive_is_item_in_array(model, model->item_idx)) {
model->menu = true;
model->menu_idx = 0;
ArchiveFile_t* selected =
files_array_get(model->files, model->item_idx - model->array_offset);
selected->fav = archive_is_favorite("%s", string_get_cstr(selected->name));
}
} else {
model->menu = false;
model->menu_idx = 0;
}
return true;
@@ -247,6 +330,8 @@ void archive_show_file_menu(ArchiveBrowserView* browser, bool show) {
}
void archive_favorites_move_mode(ArchiveBrowserView* browser, bool active) {
furi_assert(browser);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->move_fav = active;
@@ -282,7 +367,8 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
} else if(strncmp(path, "/app:", 5) == 0) {
if(archive_app_is_available(browser, path)) tab_empty = false;
} else {
if(archive_dir_not_empty(browser, archive_get_default_path(tab))) tab_empty = false;
uint32_t files_cnt = archive_dir_count_items(browser, archive_get_default_path(tab));
if(files_cnt > 0) tab_empty = false;
}
if((tab_empty) && (tab != ArchiveTabBrowser)) {
@@ -291,8 +377,9 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
if(model->last_tab != model->tab_idx) {
model->idx = 0;
model->depth = 0;
model->item_idx = 0;
model->array_offset = 0;
idx_last_array_reset(model->idx_last);
}
return false;
});
@@ -305,11 +392,13 @@ void archive_enter_dir(ArchiveBrowserView* browser, string_t name) {
furi_assert(browser);
furi_assert(name);
archive_dir_count_items(browser, string_get_cstr(name));
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->last_idx = model->idx;
model->idx = 0;
model->depth = CLAMP(model->depth + 1, MAX_DEPTH, 0);
idx_last_array_push_back(model->idx_last, model->item_idx);
model->array_offset = 0;
model->item_idx = 0;
return false;
});
@@ -329,10 +418,11 @@ void archive_leave_dir(ArchiveBrowserView* browser) {
string_left(browser->path, pos);
}
archive_dir_count_items(browser, path);
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->depth = CLAMP(model->depth - 1, MAX_DEPTH, 0);
model->idx = model->last_idx;
idx_last_array_pop_back(&model->item_idx, model->idx_last);
return false;
});

View File

@@ -2,7 +2,8 @@
#include "../archive_i.h"
#define DEFAULT_TAB_DIR InputKeyRight //default tab swith direction
#define TAB_RIGHT InputKeyRight //default tab swith direction
#define FILE_LIST_BUF_LEN 100
static const char* tab_default_paths[] = {
[ArchiveTabFavorites] = "/any/favorites",
@@ -56,14 +57,18 @@ inline bool archive_is_known_app(ArchiveFileTypeEnum type) {
return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown);
}
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx);
void archive_update_offset(ArchiveBrowserView* browser);
void archive_update_focus(ArchiveBrowserView* browser, const char* target);
size_t archive_file_array_size(ArchiveBrowserView* browser);
bool archive_file_array_load(ArchiveBrowserView* browser, int8_t dir);
size_t archive_file_get_array_size(ArchiveBrowserView* browser);
void archive_file_array_rm_selected(ArchiveBrowserView* browser);
void archive_file_array_swap(ArchiveBrowserView* browser, int8_t d);
void archive_file_array_swap(ArchiveBrowserView* browser, int8_t dir);
void archive_file_array_rm_all(ArchiveBrowserView* browser);
void archive_set_item_count(ArchiveBrowserView* browser, uint32_t count);
ArchiveFile_t* archive_get_current_file(ArchiveBrowserView* browser);
ArchiveFile_t* archive_get_file_at(ArchiveBrowserView* browser, size_t idx);
ArchiveTabEnum archive_get_tab(ArchiveBrowserView* browser);

View File

@@ -84,6 +84,9 @@ bool archive_favorites_read(void* context) {
string_init(buffer);
bool need_refresh = false;
uint16_t file_count = 0;
archive_file_array_rm_all(browser);
bool result = file_worker_open(file_worker, ARCHIVE_FAV_PATH, FSAM_READ, FSOM_OPEN_EXISTING);
@@ -99,6 +102,7 @@ bool archive_favorites_read(void* context) {
if(string_search(buffer, "/app:") == 0) {
if(archive_app_is_available(browser, string_get_cstr(buffer))) {
archive_add_app_item(browser, string_get_cstr(buffer));
file_count++;
} else {
need_refresh = true;
}
@@ -106,10 +110,12 @@ bool archive_favorites_read(void* context) {
bool file_exists = false;
file_worker_is_file_exist(file_worker, string_get_cstr(buffer), &file_exists);
if(file_exists)
if(file_exists) {
archive_add_file_item(browser, &file_info, string_get_cstr(buffer));
else
file_count++;
} else {
need_refresh = true;
}
}
string_reset(buffer);
@@ -119,6 +125,8 @@ bool archive_favorites_read(void* context) {
file_worker_close(file_worker);
file_worker_free(file_worker);
archive_set_item_count(browser, file_count);
if(need_refresh) {
archive_favourites_rescan();
}
@@ -257,7 +265,7 @@ void archive_favorites_save(void* context) {
ArchiveBrowserView* browser = context;
FileWorker* file_worker = file_worker_alloc(true);
for(size_t i = 0; i < archive_file_array_size(browser); i++) {
for(size_t i = 0; i < archive_file_get_array_size(browser); i++) {
ArchiveFile_t* item = archive_get_file_at(browser, i);
archive_file_append(ARCHIVE_FAV_TEMP_PATH, "%s\n", string_get_cstr(item->name));
}

View File

@@ -6,7 +6,7 @@
#define ASSETS_DIR "assets"
bool filter_by_extension(FileInfo* file_info, const char* tab_ext, const char* name) {
bool archive_filter_by_extension(FileInfo* file_info, const char* tab_ext, const char* name) {
furi_assert(file_info);
furi_assert(tab_ext);
furi_assert(name);
@@ -45,7 +45,7 @@ void archive_get_file_extension(char* name, char* ext) {
strncpy(ext, dot, MAX_EXT_LEN);
}
void set_file_type(ArchiveFile_t* file, FileInfo* file_info, const char* path, bool is_app) {
void archive_set_file_type(ArchiveFile_t* file, FileInfo* file_info, const char* path, bool is_app) {
furi_assert(file);
file->is_app = is_app;
@@ -83,21 +83,19 @@ bool archive_get_filenames(void* context, const char* path) {
bool res;
ArchiveBrowserView* browser = context;
archive_file_array_rm_all(browser);
if(archive_get_tab(browser) == ArchiveTabFavorites) {
res = archive_favorites_read(browser);
} else if(strncmp(path, "/app:", 5) == 0) {
res = archive_app_read_dir(browser, path);
} else {
res = archive_read_dir(browser, path);
res = archive_file_array_load(browser, 0);
}
return res;
}
bool archive_dir_not_empty(void* context, const char* path) { // can be simpler?
uint32_t archive_dir_count_items(void* context, const char* path) {
furi_assert(context);
ArchiveBrowserView* browser = context;
FileInfo file_info;
@@ -108,23 +106,19 @@ bool archive_dir_not_empty(void* context, const char* path) { // can be simpler?
if(!storage_dir_open(directory, path)) {
storage_dir_close(directory);
storage_file_free(directory);
return false;
return 0;
}
bool files_found = false;
uint32_t files_found = 0;
while(1) {
if(!storage_dir_read(directory, &file_info, name, MAX_NAME_LEN)) {
break;
}
if(files_found) {
break;
} else if((storage_file_get_error(directory) == FSE_OK) && (name[0])) {
if(filter_by_extension(
if((storage_file_get_error(directory) == FSE_OK) && (name[0])) {
if(archive_filter_by_extension(
&file_info, archive_get_tab_ext(archive_get_tab(browser)), name)) {
files_found = true;
files_found++;
}
} else {
return false;
}
}
storage_dir_close(directory);
@@ -132,10 +126,12 @@ bool archive_dir_not_empty(void* context, const char* path) { // can be simpler?
furi_record_close("storage");
archive_set_item_count(browser, files_found);
return files_found;
}
bool archive_read_dir(void* context, const char* path) {
uint32_t archive_dir_read_items(void* context, const char* path, uint32_t offset, uint32_t count) {
furi_assert(context);
ArchiveBrowserView* browser = context;
@@ -145,7 +141,6 @@ bool archive_read_dir(void* context, const char* path) {
char name[MAX_NAME_LEN];
snprintf(name, MAX_NAME_LEN, "%s/", path);
size_t path_len = strlen(name);
size_t files_cnt = 0;
if(!storage_dir_open(directory, path)) {
storage_dir_close(directory);
@@ -153,28 +148,48 @@ bool archive_read_dir(void* context, const char* path) {
return false;
}
while(1) {
// Skip items before offset
uint32_t items_cnt = 0;
while(items_cnt < offset) {
if(!storage_dir_read(directory, &file_info, &name[path_len], MAX_NAME_LEN)) {
break;
}
if(storage_file_get_error(directory) == FSE_OK) {
if(archive_filter_by_extension(
&file_info, archive_get_tab_ext(archive_get_tab(browser)), name)) {
items_cnt++;
}
} else {
break;
}
}
if(items_cnt != offset) {
storage_dir_close(directory);
storage_file_free(directory);
furi_record_close("storage");
return false;
}
items_cnt = 0;
archive_file_array_rm_all(browser);
while(items_cnt < count) {
if(!storage_dir_read(directory, &file_info, &name[path_len], MAX_NAME_LEN - path_len)) {
break;
}
if(files_cnt > MAX_FILES) {
break;
} else if(storage_file_get_error(directory) == FSE_OK) {
if(storage_file_get_error(directory) == FSE_OK) {
archive_add_file_item(browser, &file_info, name);
++files_cnt;
items_cnt++;
} else {
storage_dir_close(directory);
storage_file_free(directory);
return false;
break;
}
}
storage_dir_close(directory);
storage_file_free(directory);
furi_record_close("storage");
return true;
return (items_cnt == count);
}
void archive_file_append(const char* path, const char* format, ...) {
@@ -210,10 +225,20 @@ void archive_delete_file(void* context, const char* format, ...) {
va_end(args);
ArchiveBrowserView* browser = context;
FileWorker* file_worker = file_worker_alloc(true);
Storage* fs_api = furi_record_open("storage");
bool res = file_worker_remove(file_worker, string_get_cstr(filename));
file_worker_free(file_worker);
FileInfo fileinfo;
storage_common_stat(fs_api, string_get_cstr(filename), &fileinfo);
bool res = false;
if(fileinfo.flags & FSF_DIRECTORY) {
res = storage_simply_remove_recursive(fs_api, string_get_cstr(filename));
} else {
res = (storage_common_remove(fs_api, string_get_cstr(filename)) == FSE_OK);
}
furi_record_close("storage");
if(archive_is_favorite("%s", string_get_cstr(filename))) {
archive_favorites_delete("%s", string_get_cstr(filename));
@@ -224,4 +249,4 @@ void archive_delete_file(void* context, const char* format, ...) {
}
string_clear(filename);
}
}

View File

@@ -2,8 +2,6 @@
#include "file_worker.h"
#include <m-array.h>
#define MAX_FILES 100 //temp
typedef enum {
ArchiveFileTypeIButton,
ArchiveFileTypeNFC,
@@ -14,7 +12,7 @@ typedef enum {
ArchiveFileTypeU2f,
ArchiveFileTypeFolder,
ArchiveFileTypeUnknown,
ArchiveFileTypesTotal,
ArchiveFileTypeLoading,
} ArchiveFileTypeEnum;
typedef struct {
@@ -57,12 +55,12 @@ ARRAY_DEF(
INIT_SET(API_6(ArchiveFile_t_init_set)),
CLEAR(API_2(ArchiveFile_t_clear))))
bool filter_by_extension(FileInfo* file_info, const char* tab_ext, const char* name);
void set_file_type(ArchiveFile_t* file, FileInfo* file_info, const char* path, bool is_app);
bool archive_filter_by_extension(FileInfo* file_info, const char* tab_ext, const char* name);
void archive_set_file_type(ArchiveFile_t* file, FileInfo* file_info, const char* path, bool is_app);
void archive_trim_file_path(char* name, bool ext);
void archive_get_file_extension(char* name, char* ext);
bool archive_get_filenames(void* context, const char* path);
bool archive_dir_not_empty(void* context, const char* path);
bool archive_read_dir(void* context, const char* path);
uint32_t archive_dir_count_items(void* context, const char* path);
uint32_t archive_dir_read_items(void* context, const char* path, uint32_t offset, uint32_t count);
void archive_file_append(const char* path, const char* format, ...);
void archive_delete_file(void* context, const char* format, ...);
void archive_delete_file(void* context, const char* format, ...);