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