diff --git a/applications/services/storage/storage.c b/applications/services/storage/storage.c index f2997ffcf4..b51c0df6c4 100644 --- a/applications/services/storage/storage.c +++ b/applications/services/storage/storage.c @@ -43,10 +43,12 @@ Storage* storage_app_alloc(void) { } #ifndef FURI_RAM_EXEC - storage_mnt_init(&app->storage[ST_MNT]); storage_int_init(&app->storage[ST_INT]); #endif storage_ext_init(&app->storage[ST_EXT]); +#ifndef FURI_RAM_EXEC + storage_mnt_init(&app->storage[ST_MNT]); +#endif // sd icon gui app->sd_gui.enabled = false; diff --git a/applications/services/storage/storage_glue.c b/applications/services/storage/storage_glue.c index 41da6c3f48..727af765fe 100644 --- a/applications/services/storage/storage_glue.c +++ b/applications/services/storage/storage_glue.c @@ -156,3 +156,9 @@ size_t storage_open_files_count(StorageData* storage) { size_t count = StorageFileList_size(storage->files); return count; } + +const char* storage_file_get_path(File* file, StorageData* storage) { + StorageFile* storage_file_ref = storage_get_file(file, storage); + if(!storage_file_ref) return ""; + return furi_string_get_cstr(storage_file_ref->path); +} \ No newline at end of file diff --git a/applications/services/storage/storage_glue.h b/applications/services/storage/storage_glue.h index fbc08ebbf9..9a19ae815a 100644 --- a/applications/services/storage/storage_glue.h +++ b/applications/services/storage/storage_glue.h @@ -35,6 +35,7 @@ void storage_file_init(StorageFile* obj); void storage_file_init_set(StorageFile* obj, const StorageFile* src); void storage_file_set(StorageFile* obj, const StorageFile* src); void storage_file_clear(StorageFile* obj); +const char* storage_file_get_path(File* file, StorageData* storage); void storage_data_init(StorageData* storage); StorageStatus storage_data_status(StorageData* storage); diff --git a/applications/services/storage/storages/storage_ext.c b/applications/services/storage/storages/storage_ext.c index 0bb3133358..971f1df171 100644 --- a/applications/services/storage/storages/storage_ext.c +++ b/applications/services/storage/storages/storage_ext.c @@ -4,6 +4,7 @@ #include #include "sd_notify.h" #include +#include typedef FIL SDFile; typedef DIR SDDir; @@ -741,6 +742,20 @@ FS_Error storage_process_virtual_format(StorageData* storage) { SDError error = f_mkfs(sd_data->path, FM_ANY, 0, work, _MAX_SS); free(work); if(error != FR_OK) return FSE_INTERNAL; + + if(storage_process_virtual_mount(storage) == FSE_OK) { + // Image file path + const char* img_path = storage_file_get_path(mnt_image, mnt_image_storage); + // Image file name + FuriString* img_name = furi_string_alloc(); + path_extract_filename_no_ext(img_path, img_name); + // Label with drive id prefix + char* label = storage_ext_drive_path(storage, furi_string_get_cstr(img_name)); + furi_string_free(img_name); + f_setlabel(label); + free(label); + storage_process_virtual_unmount(storage); + } return FSE_OK; #endif }