remove region_data from int

This commit is contained in:
MX
2023-05-17 22:37:24 +03:00
parent 95d6465dac
commit 35d72d82b4

View File

@@ -5,6 +5,7 @@
#include <stdint.h>
#include <toolbox/dir_walk.h>
#include <toolbox/path.h>
#include <furi_hal.h>
#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;
}