2022-07-20 13:56:33 +03:00
|
|
|
#include <core/record.h>
|
2022-04-13 23:50:25 +03:00
|
|
|
#include "storage.h"
|
|
|
|
#include <toolbox/tar/tar_archive.h>
|
|
|
|
|
2024-03-06 09:25:21 +03:00
|
|
|
FS_Error storage_int_backup(Storage* storage, const char* dstname) {
|
2024-03-19 17:43:52 +03:00
|
|
|
furi_check(storage);
|
|
|
|
|
2024-03-06 09:25:21 +03:00
|
|
|
TarArchive* archive = tar_archive_alloc(storage);
|
2024-06-30 13:38:48 +03:00
|
|
|
bool success = tar_archive_open(archive, dstname, TarOpenModeWrite) &&
|
2022-07-26 15:21:51 +03:00
|
|
|
tar_archive_add_dir(archive, STORAGE_INT_PATH_PREFIX, "") &&
|
|
|
|
tar_archive_finalize(archive);
|
2022-04-13 23:50:25 +03:00
|
|
|
tar_archive_free(archive);
|
|
|
|
return success ? FSE_OK : FSE_INTERNAL;
|
|
|
|
}
|
|
|
|
|
2024-03-06 09:25:21 +03:00
|
|
|
FS_Error
|
2024-08-04 12:54:02 +03:00
|
|
|
storage_int_restore(Storage* storage, const char* srcname, StorageNameConverter converter) {
|
2024-03-19 17:43:52 +03:00
|
|
|
furi_check(storage);
|
|
|
|
|
2024-03-06 09:25:21 +03:00
|
|
|
TarArchive* archive = tar_archive_alloc(storage);
|
2024-06-30 13:38:48 +03:00
|
|
|
bool success = tar_archive_open(archive, srcname, TarOpenModeRead) &&
|
2022-07-26 15:21:51 +03:00
|
|
|
tar_archive_unpack_to(archive, STORAGE_INT_PATH_PREFIX, converter);
|
2022-04-13 23:50:25 +03:00
|
|
|
tar_archive_free(archive);
|
|
|
|
return success ? FSE_OK : FSE_INTERNAL;
|
2022-05-06 16:37:10 +03:00
|
|
|
}
|