mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
Better virtual mount error handling --nobuild
This commit is contained in:
@@ -109,7 +109,7 @@ static void js_usbdisk_create_image(struct mjs* mjs) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(storage);
|
||||
do {
|
||||
if(!storage_file_open(file, path, FSAM_WRITE, FSOM_CREATE_NEW)) {
|
||||
if(!storage_file_open(file, path, FSAM_READ | FSAM_WRITE, FSOM_CREATE_NEW)) {
|
||||
error = storage_file_get_error_desc(file);
|
||||
break;
|
||||
}
|
||||
@@ -120,10 +120,14 @@ static void js_usbdisk_create_image(struct mjs* mjs) {
|
||||
}
|
||||
|
||||
error = "Image formatting failed";
|
||||
if(storage_virtual_init(storage, file) != FSE_OK) break;
|
||||
if(storage_virtual_format(storage) != FSE_OK) break;
|
||||
if(storage_virtual_quit(storage) != FSE_OK) break;
|
||||
error = NULL;
|
||||
if(storage_virtual_init(storage, file) != FSE_OK) {
|
||||
if(storage_virtual_quit(storage) != FSE_OK) break;
|
||||
if(storage_virtual_init(storage, file) != FSE_OK) break;
|
||||
}
|
||||
if(storage_virtual_format(storage) == FSE_OK) {
|
||||
error = NULL;
|
||||
}
|
||||
storage_virtual_quit(storage);
|
||||
} while(0);
|
||||
storage_file_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
@@ -131,7 +131,7 @@ bool mass_storage_scene_create_image_on_event(void* context, SceneManagerEvent e
|
||||
if(!storage_file_open(
|
||||
app->file,
|
||||
furi_string_get_cstr(app->file_path),
|
||||
FSAM_WRITE,
|
||||
FSAM_READ | FSAM_WRITE,
|
||||
FSOM_CREATE_NEW))
|
||||
break;
|
||||
|
||||
@@ -140,11 +140,15 @@ bool mass_storage_scene_create_image_on_event(void* context, SceneManagerEvent e
|
||||
if(!storage_file_expand(app->file, size)) break;
|
||||
|
||||
// Format as exFAT
|
||||
if(storage_virtual_init(app->fs_api, app->file) != FSE_OK) break;
|
||||
if(storage_virtual_format(app->fs_api) != FSE_OK) break;
|
||||
if(storage_virtual_quit(app->fs_api) != FSE_OK) break;
|
||||
|
||||
success = true;
|
||||
error = "Image formatting failed";
|
||||
if(storage_virtual_init(app->fs_api, app->file) != FSE_OK) {
|
||||
if(storage_virtual_quit(app->fs_api) != FSE_OK) break;
|
||||
if(storage_virtual_init(app->fs_api, app->file) != FSE_OK) break;
|
||||
}
|
||||
if(storage_virtual_format(app->fs_api) == FSE_OK) {
|
||||
success = true;
|
||||
}
|
||||
storage_virtual_quit(app->fs_api);
|
||||
} while(false);
|
||||
|
||||
if(!success) {
|
||||
|
||||
Reference in New Issue
Block a user