mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-26 01:48:10 -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);
|
||||
|
||||
Reference in New Issue
Block a user