mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-21 02:03:18 +00:00
f8b532f063
* updater: remove files from existing resources Manifest file before deploying new resources * toolbox: tar: single file extraction API Co-authored-by: あく <alleteam@gmail.com>
58 lines
No EOL
1.4 KiB
C
58 lines
No EOL
1.4 KiB
C
#pragma once
|
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <m-string.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
ResourceManifestEntryTypeUnknown = 0,
|
|
ResourceManifestEntryTypeDirectory,
|
|
ResourceManifestEntryTypeFile,
|
|
} ResourceManifestEntryType;
|
|
|
|
typedef struct {
|
|
ResourceManifestEntryType type;
|
|
string_t name;
|
|
uint32_t size;
|
|
uint8_t hash[16];
|
|
} ResourceManifestEntry;
|
|
|
|
typedef struct ResourceManifestReader ResourceManifestReader;
|
|
|
|
/**
|
|
* @brief Initialize resource manifest reader
|
|
* @param storage Storage API pointer
|
|
* @return allocated object
|
|
*/
|
|
ResourceManifestReader* resource_manifest_reader_alloc(Storage* storage);
|
|
|
|
/**
|
|
* @brief Release resource manifest reader
|
|
* @param resource_manifest allocated object
|
|
*/
|
|
void resource_manifest_reader_free(ResourceManifestReader* resource_manifest);
|
|
|
|
/**
|
|
* @brief Initialize resource manifest reader iteration
|
|
* @param resource_manifest allocated object
|
|
* @param filename manifest file name
|
|
* @return true if file opened
|
|
*/
|
|
bool resource_manifest_reader_open(ResourceManifestReader* resource_manifest, const char* filename);
|
|
|
|
/**
|
|
* @brief Read next file/dir entry from manifest
|
|
* @param resource_manifest allocated object
|
|
* @return entry or NULL if end of file
|
|
*/
|
|
ResourceManifestEntry* resource_manifest_reader_next(ResourceManifestReader* resource_manifest);
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif |