Archive fix unpinning last item

This commit is contained in:
Willy-JL
2023-06-04 17:09:37 +01:00
parent b5aa4afd9f
commit 945bc46837

View File

@@ -112,7 +112,9 @@ static bool archive_favourites_rescan() {
furi_string_free(buffer);
storage_file_close(file);
storage_common_move(storage, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH);
if(storage_common_move(storage, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH) == FSE_NOT_EXIST) {
storage_common_remove(storage, ARCHIVE_FAV_PATH);
}
storage_file_free(file);
furi_record_close(RECORD_STORAGE);
@@ -215,7 +217,9 @@ bool archive_favorites_delete(const char* format, ...) {
furi_string_free(filename);
storage_file_close(file);
storage_common_move(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH);
if(storage_common_move(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH) == FSE_NOT_EXIST) {
storage_common_remove(fs_api, ARCHIVE_FAV_PATH);
}
storage_file_free(file);
furi_record_close(RECORD_STORAGE);
@@ -298,7 +302,9 @@ bool archive_favorites_rename(const char* src, const char* dst) {
furi_string_free(path);
storage_file_close(file);
storage_common_move(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH);
if(storage_common_move(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH) == FSE_NOT_EXIST) {
storage_common_remove(fs_api, ARCHIVE_FAV_PATH);
}
storage_file_free(file);
furi_record_close(RECORD_STORAGE);
@@ -324,7 +330,9 @@ void archive_favorites_save(void* context) {
archive_file_append(ARCHIVE_FAV_TEMP_PATH, "%s\n", furi_string_get_cstr(item->path));
}
storage_common_move(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH);
if(storage_common_move(fs_api, ARCHIVE_FAV_TEMP_PATH, ARCHIVE_FAV_PATH) == FSE_NOT_EXIST) {
storage_common_remove(fs_api, ARCHIVE_FAV_PATH);
}
storage_file_free(file);
furi_record_close(RECORD_STORAGE);