diff --git a/applications/system/storage_move_to_sd/storage_move_to_sd.c b/applications/system/storage_move_to_sd/storage_move_to_sd.c index 9c91b9266..2f33eec33 100644 --- a/applications/system/storage_move_to_sd/storage_move_to_sd.c +++ b/applications/system/storage_move_to_sd/storage_move_to_sd.c @@ -5,6 +5,7 @@ #include #include #include +#include #define TAG "MoveToSd" @@ -20,6 +21,17 @@ static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo, return (name && (*name != '.')); } +static void storage_move_to_sd_remove_region() { + if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) return; + Storage* storage = furi_record_open(RECORD_STORAGE); + + if(storage_common_exists(storage, INT_PATH(".region_data"))) { + storage_common_remove(storage, INT_PATH(".region_data")); + } + + furi_record_close(RECORD_STORAGE); +} + bool storage_move_to_sd_perform(void) { Storage* storage = furi_record_open(RECORD_STORAGE); @@ -162,6 +174,9 @@ int32_t storage_move_to_sd_app(void* p) { FURI_LOG_I(TAG, "Nothing to move"); } + // Remove unused region file from int memory + storage_move_to_sd_remove_region(); + return 0; }