ExtSaveData: Fix error codes & always create user/boss directories

This commit is contained in:
wheremyfoodat 2024-12-14 21:03:44 +02:00
parent 667717ef91
commit 8729e0dfd8

View file

@ -210,11 +210,12 @@ void ExtSaveDataArchive::format(const FSPath& path, const FormatInfo& info) {
if (!isShared) { if (!isShared) {
// Delete all contents by deleting the directory then recreating it // Delete all contents by deleting the directory then recreating it
fs::remove_all(saveDataPath); fs::remove_all(saveDataPath);
fs::create_directories(saveDataPath);
fs::create_directories(saveDataPath / "user");
fs::create_directories(saveDataPath / "boss");
} }
fs::create_directories(saveDataPath);
fs::create_directories(saveDataPath / "user");
fs::create_directories(saveDataPath / "boss");
// Write format info on disk // Write format info on disk
IOFile file(formatInfoPath, "wb"); IOFile file(formatInfoPath, "wb");
file.writeBytes(&info, sizeof(info)); file.writeBytes(&info, sizeof(info));
@ -248,7 +249,7 @@ Rust::Result<ArchiveBase::FormatInfo, HorizonResult> ExtSaveDataArchive::getForm
// If the file failed to open somehow, we return that the archive is not formatted // If the file failed to open somehow, we return that the archive is not formatted
if (!file.isOpen()) { if (!file.isOpen()) {
return Err(Result::FS::NotFormatted); return isShared ? Err(Result::FS::NotFormatted) : Err(Result::FS::NotFoundInvalid);
} }
FormatInfo ret = {}; FormatInfo ret = {};