This commit is contained in:
wheremyfoodat 2024-03-08 17:07:40 +02:00
parent 6e48c7fbdd
commit 47a01a8296
3 changed files with 35 additions and 44 deletions

View file

@ -61,7 +61,7 @@ namespace MediaType {
enum : u8 {
NAND = 0,
SD = 1,
Gamecard = 2
Gamecard = 2,
};
};
@ -230,26 +230,26 @@ public:
virtual HorizonResult createFile(const FSPath& path, u64 size) = 0;
virtual HorizonResult deleteFile(const FSPath& path) = 0;
virtual Rust::Result<FormatInfo, HorizonResult> getFormatInfo(const FSPath& path) {
Helpers::panic("Unimplemented GetFormatInfo for %s archive", name().c_str());
// Return a dummy struct just to avoid the UB of not returning anything, even if we panic
return Ok(FormatInfo{ .size = 0, .numOfDirectories = 0, .numOfFiles = 0, .duplicateData = false });
}
virtual Rust::Result<FormatInfo, HorizonResult> getFormatInfo(const FSPath& path) {
Helpers::panic("Unimplemented GetFormatInfo for %s archive", name().c_str());
// Return a dummy struct just to avoid the UB of not returning anything, even if we panic
return Ok(FormatInfo{.size = 0, .numOfDirectories = 0, .numOfFiles = 0, .duplicateData = false});
}
virtual HorizonResult createDirectory(const FSPath& path) {
Helpers::panic("Unimplemented CreateDirectory for %s archive", name().c_str());
return Result::FS::AlreadyExists;
}
Helpers::panic("Unimplemented CreateDirectory for %s archive", name().c_str());
return Result::FS::AlreadyExists;
}
virtual HorizonResult deleteDirectory(const FSPath& path) {
Helpers::warn("Stubbed DeleteDirectory for %s archive", name().c_str());
return Result::Success;
}
Helpers::warn("Stubbed DeleteDirectory for %s archive", name().c_str());
return Result::Success;
}
virtual HorizonResult deleteDirectoryRecursively(const FSPath& path) {
Helpers::warn("Stubbed DeleteDirectoryRecursively for %s archive", name().c_str());
return Result::Success;
}
Helpers::warn("Stubbed DeleteDirectoryRecursively for %s archive", name().c_str());
return Result::Success;
}
// Returns nullopt if opening the file failed, otherwise returns a file descriptor to it (nullptr if none is needed)
virtual FileDescriptor openFile(const FSPath& path, const FilePerms& perms) = 0;