mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-04-25 07:57:04 -05:00
Update some restore logic. Ensure save is wiped before restore again.
This commit is contained in:
parent
fd469c057d
commit
27ff070b7a
2
Makefile
2
Makefile
|
|
@ -39,7 +39,7 @@ INCLUDES := include ./Libraries/FsLib/Switch/FsLib/include ./Libraries/SDLLib/SD
|
|||
EXEFS_SRC := exefs_src
|
||||
APP_TITLE := JKSV
|
||||
APP_AUTHOR := JK
|
||||
APP_VERSION := 08.21.2025
|
||||
APP_VERSION := 08.24.2025
|
||||
ROMFS := romfs
|
||||
ICON := icon.jpg
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace
|
|||
/// @brief Build month.
|
||||
constexpr uint8_t BUILD_MON = 8;
|
||||
/// @brief Build day.
|
||||
constexpr uint8_t BUILD_DAY = 21;
|
||||
constexpr uint8_t BUILD_DAY = 24;
|
||||
/// @brief Year.
|
||||
constexpr uint16_t BUILD_YEAR = 2025;
|
||||
} // namespace
|
||||
|
|
@ -41,7 +41,7 @@ static bool initialize_service(Result (*function)(Args...), const char *serviceN
|
|||
Result error = (*function)(args...);
|
||||
if (R_FAILED(error))
|
||||
{
|
||||
logger::log("Error initializing %s: 0x%X.", error);
|
||||
logger::log("Error initializing %s: 0x%X.", serviceName, error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -178,13 +178,13 @@ void fs::copy_zip_to_directory(fs::MiniUnzip &unzip,
|
|||
if (lastDir == fullDest.NOT_FOUND) { continue; }
|
||||
|
||||
const fslib::Path dirPath{fullDest.sub_path(lastDir)};
|
||||
const bool dirExists = fslib::directory_exists(dirPath);
|
||||
const bool dirFailed = !dirExists && dirPath.is_valid() && error::fslib(fslib::create_directories_recursively(dirPath));
|
||||
if (!dirExists && dirFailed) { continue; }
|
||||
const bool exists = dirPath.is_valid() && fslib::directory_exists(dirPath);
|
||||
const bool createError = dirPath.is_valid() && !exists && error::fslib(fslib::create_directories_recursively(dirPath));
|
||||
if (dirPath.is_valid() && !exists && createError) { continue; }
|
||||
|
||||
const int64_t fileSize = unzip.get_uncompressed_size();
|
||||
fslib::File destFile{fullDest, FsOpenMode_Create | FsOpenMode_Write, fileSize};
|
||||
if (!destFile.is_open()) { return; }
|
||||
if (error::fslib(destFile.is_open())) { continue; }
|
||||
|
||||
if (task)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -210,6 +210,12 @@ void tasks::backup::restore_backup_local(sys::ProgressTask *task, BackupMenuStat
|
|||
const int popTicks = ui::PopMessageManager::DEFAULT_TICKS;
|
||||
if (autoBackup) { auto_backup(task, taskData); }
|
||||
|
||||
{
|
||||
auto scopedMount = create_scoped_mount(saveInfo);
|
||||
error::fslib(fslib::delete_directory_recursively(fs::DEFAULT_SAVE_ROOT));
|
||||
error::fslib(fslib::commit_data_to_file_system(fs::DEFAULT_SAVE_MOUNT));
|
||||
}
|
||||
|
||||
if (!isDir && hasZipExt)
|
||||
{
|
||||
fs::MiniUnzip unzip{target};
|
||||
|
|
@ -256,6 +262,12 @@ void tasks::backup::restore_backup_remote(sys::ProgressTask *task, BackupMenuSta
|
|||
|
||||
if (autoBackup) { auto_backup(task, taskData); }
|
||||
|
||||
{
|
||||
auto scopedMount = create_scoped_mount(saveInfo);
|
||||
error::fslib(fslib::delete_directory_recursively(fs::DEFAULT_SAVE_ROOT));
|
||||
error::fslib(fslib::commit_data_to_file_system(fs::DEFAULT_SAVE_MOUNT));
|
||||
}
|
||||
|
||||
const int popTicks = ui::PopMessageManager::DEFAULT_TICKS;
|
||||
remote::Item *target = taskData->remoteItem;
|
||||
const fslib::Path tempPath{PATH_JKSV_TEMP};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user