feat: diagnostic exports

This commit is contained in:
2025-04-30 21:19:15 +00:00
parent edef5cc6dc
commit 2e17e0ae75
7 changed files with 83 additions and 16 deletions

View File

@ -36,7 +36,7 @@ impl Profile {
Ok(())
}
pub fn export(&self, export_keychip: bool, extra_files: Vec<String>) -> anyhow::Result<()> {
pub fn export(&self, export_keychip: bool, extra_files: Vec<String>, is_diagnostic: bool) -> anyhow::Result<()> {
let mut prf = self.clone();
let dir = util::config_dir().join("exports");
@ -45,7 +45,7 @@ impl Profile {
std::fs::create_dir(&dir)?;
}
let path = dir.join(format!("{}-{}-template.zip", &self.meta.game, &self.meta.name));
let path = dir.join(format!("{}-{}-{}.zip", &self.meta.game, &self.meta.name, if is_diagnostic { "diagnostic" } else { "template" } ));
{
let sgt = &mut prf.data.sgt;
@ -66,7 +66,7 @@ impl Profile {
if network.local_path.is_absolute() {
network.local_path = PathBuf::new();
}
if !export_keychip {
if !export_keychip || is_diagnostic {
network.keychip = String::new();
}
}
@ -83,6 +83,29 @@ impl Profile {
zip.write_all(&std::fs::read(self.config_dir().join(file))?)?;
}
if is_diagnostic {
let name = "mu3.exe.log";
let path = self.data_dir().join(name);
if path.exists() {
zip.start_file(name, options)?;
zip.write_all(&std::fs::read(path)?)?;
}
let name = "chusanApp.exe.log";
let path = self.data_dir().join(name);
if path.exists() {
zip.start_file(name, options)?;
zip.write_all(&std::fs::read(path)?)?;
}
let name = "amdaemon.exe.log";
let path = self.data_dir().join(name);
if path.exists() {
zip.start_file(name, options)?;
zip.write_all(&std::fs::read(path)?)?;
}
}
zip.finish()?;
Ok(())