unleashed-firmware/applications/main/archive/helpers/archive_files.h
SG b9a766d909 [FL-2627] Flipper applications: SDK, build and debug system (#1387)
* Added support for running applications from SD card (FAPs - Flipper Application Packages)
* Added plugin_dist target for fbt to build FAPs
* All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default
* Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them
* Added debugging support for FAPs with fbt debug & VSCode
* Added public firmware API with automated versioning

Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2022-09-15 02:21:03 +09:00

64 lines
1.7 KiB
C

#pragma once
#include <m-array.h>
#include <m-string.h>
#include <storage/storage.h>
typedef enum {
ArchiveFileTypeIButton,
ArchiveFileTypeNFC,
ArchiveFileTypeSubGhz,
ArchiveFileTypeLFRFID,
ArchiveFileTypeInfrared,
ArchiveFileTypeBadUsb,
ArchiveFileTypeU2f,
ArchiveFileTypeUpdateManifest,
ArchiveFileTypeFolder,
ArchiveFileTypeUnknown,
ArchiveFileTypeLoading,
} ArchiveFileTypeEnum;
typedef struct {
string_t path;
ArchiveFileTypeEnum type;
bool fav;
bool is_app;
} ArchiveFile_t;
static void ArchiveFile_t_init(ArchiveFile_t* obj) {
obj->type = ArchiveFileTypeUnknown;
obj->is_app = false;
obj->fav = false;
string_init(obj->path);
}
static void ArchiveFile_t_init_set(ArchiveFile_t* obj, const ArchiveFile_t* src) {
obj->type = src->type;
obj->is_app = src->is_app;
obj->fav = src->fav;
string_init_set(obj->path, src->path);
}
static void ArchiveFile_t_set(ArchiveFile_t* obj, const ArchiveFile_t* src) {
obj->type = src->type;
obj->is_app = src->is_app;
obj->fav = src->fav;
string_set(obj->path, src->path);
}
static void ArchiveFile_t_clear(ArchiveFile_t* obj) {
string_clear(obj->path);
}
ARRAY_DEF(
files_array,
ArchiveFile_t,
(INIT(API_2(ArchiveFile_t_init)),
SET(API_6(ArchiveFile_t_set)),
INIT_SET(API_6(ArchiveFile_t_init_set)),
CLEAR(API_2(ArchiveFile_t_clear))))
void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder, bool is_app);
bool archive_get_items(void* context, const char* path);
void archive_file_append(const char* path, const char* format, ...);
void archive_delete_file(void* context, const char* format, ...);