flow improvements

This commit is contained in:
2026-04-25 16:02:39 +03:00
parent 22b669fae0
commit 4ffa6ed970
21 changed files with 150 additions and 59 deletions
+6
View File
@@ -62,6 +62,10 @@ void io::copyFile(const std::string& srcPath, const std::string& dstPath)
while (offset < sz) {
u32 count = fread((char*)buf, 1, BUFFER_SIZE, src);
if (count == 0) {
Logger::getInstance().log(Logger::ERROR, "fread returned 0 for file {} at offset {}/{} with errno {}. Aborting copy.", srcPath, offset, sz, errno);
break;
}
fwrite((char*)buf, 1, count, dst);
offset += count;
}
@@ -161,6 +165,7 @@ std::tuple<bool, Result, std::string> io::backup(size_t index, AccountUid uid)
if (R_SUCCEEDED(res)) {
int rc = FileSystem::mount(fileSystem);
if (rc == -1) {
fsFsClose(&fileSystem);
FileSystem::unmount();
Logger::getInstance().log(Logger::ERROR, "Failed to mount filesystem during backup. Title id: 0x%016lX; User id: 0x%lX%lX.", title.id(),
title.userId().uid[1], title.userId().uid[0]);
@@ -257,6 +262,7 @@ std::tuple<bool, Result, std::string> io::restore(size_t index, AccountUid uid,
if (R_SUCCEEDED(res)) {
int rc = FileSystem::mount(fileSystem);
if (rc == -1) {
fsFsClose(&fileSystem);
FileSystem::unmount();
Logger::getInstance().log(Logger::ERROR, "Failed to mount filesystem during restore. Title id: 0x%016lX; User id: 0x%lX%lX.", title.id(),
uid.uid[1], uid.uid[0]);