Embed assets in elf file (#2466)
* FBT: file_assets generator * Elf file: process manifest section externally * FBT, file_assets generator: add assets signature * Storage: assets path alias * Flipper application: assets unpacker * Apps, Storage: use '/data' alias for apps data * Storage: copy file to file * Assets: log flag, fixes * Update f18 api * Assets: asserts * Assets: fix signature_data check * App assets: example * Example assets: fix folder structure in readme * Assets: fix error handling * Assets builder: use ansii instead of utf-8, use .fapassets section instead of .fapfiles, add assets path to signature * Elf file: comment strange places * Storage: totaly optimized storage_file_copy_to_file
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#define MAX_NAME_LENGTH 256
|
||||
#define MAX_EXT_LEN 16
|
||||
#define FILE_BUFFER_SIZE 512
|
||||
|
||||
#define TAG "StorageAPI"
|
||||
|
||||
@@ -251,6 +252,26 @@ bool storage_file_exists(Storage* storage, const char* path) {
|
||||
return exist;
|
||||
}
|
||||
|
||||
bool storage_file_copy_to_file(File* source, File* destination, uint32_t size) {
|
||||
uint8_t* buffer = malloc(FILE_BUFFER_SIZE);
|
||||
|
||||
while(size) {
|
||||
uint32_t read_size = size > FILE_BUFFER_SIZE ? FILE_BUFFER_SIZE : size;
|
||||
if(storage_file_read(source, buffer, read_size) != read_size) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(storage_file_write(destination, buffer, read_size) != read_size) {
|
||||
break;
|
||||
}
|
||||
|
||||
size -= read_size;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
return size == 0;
|
||||
}
|
||||
|
||||
/****************** DIR ******************/
|
||||
|
||||
static bool storage_dir_open_internal(File* file, const char* path) {
|
||||
|
Reference in New Issue
Block a user