Compare commits

..

No commits in common. "61e78e97185907e4300c7bb4fd399a37e62dcc86" and "edd363c3a621d705776ac8b8eeb9b97920504b5d" have entirely different histories.

View file

@ -244,8 +244,6 @@ fn extract_mod_config<R: Read + Seek>(archive: &mut ZipArchive<R>) -> Result<(Mo
None None
}; };
tracing::debug!(?legacy_mod_data);
if let Some(name) = find_archive_file(archive, "dtmt.cfg") { if let Some(name) = find_archive_file(archive, "dtmt.cfg") {
let mut f = archive let mut f = archive
.by_name(&name) .by_name(&name)
@ -278,24 +276,6 @@ fn extract_mod_config<R: Read + Seek>(archive: &mut ZipArchive<R>) -> Result<(Mo
Ok((cfg, root)) Ok((cfg, root))
} }
} else if let Some((mod_id, resources, root)) = legacy_mod_data {
let cfg = ModConfig {
bundled: false,
dir: PathBuf::new(),
id: mod_id.clone(),
name: mod_id,
summary: "A mod for the game Warhammer 40,000: Darktide".into(),
version: "N/A".into(),
description: None,
author: None,
image: None,
categories: Vec::new(),
packages: Vec::new(),
resources,
depends: Vec::new(),
};
Ok((cfg, root))
} else { } else {
eyre::bail!( eyre::bail!(
"Mod needs a config file or `.mod` file. \ "Mod needs a config file or `.mod` file. \
@ -434,8 +414,6 @@ pub(crate) async fn import_mod(state: ActionState, info: FileInfo) -> Result<Mod
None None
}; };
tracing::trace!(?nexus);
let mut archive = ZipArchive::new(data).wrap_err("Failed to open ZIP archive")?; let mut archive = ZipArchive::new(data).wrap_err("Failed to open ZIP archive")?;
if tracing::enabled!(tracing::Level::DEBUG) { if tracing::enabled!(tracing::Level::DEBUG) {
@ -450,13 +428,10 @@ pub(crate) async fn import_mod(state: ActionState, info: FileInfo) -> Result<Mod
let (mut mod_cfg, root) = let (mut mod_cfg, root) =
extract_mod_config(&mut archive).wrap_err("Failed to extract mod configuration")?; extract_mod_config(&mut archive).wrap_err("Failed to extract mod configuration")?;
tracing::info!("Importing mod {} ({})", mod_cfg.name, mod_cfg.id); tracing::info!("Importing mod {} ({})", mod_cfg.name, mod_cfg.id);
tracing::debug!(root, ?mod_cfg);
let mod_dir = state.data_dir.join(state.mod_dir.as_ref()); let mod_dir = state.data_dir.join(state.mod_dir.as_ref());
let dest = mod_dir.join(&mod_cfg.id); let dest = mod_dir.join(&mod_cfg.id);
tracing::trace!("Creating mods directory {}", dest.display());
fs::create_dir_all(&dest)
.await
.wrap_err_with(|| format!("Failed to create data directory '{}'", dest.display()))?;
let image = if let Some(path) = &mod_cfg.image { let image = if let Some(path) = &mod_cfg.image {
let name = archive let name = archive
@ -505,7 +480,11 @@ pub(crate) async fn import_mod(state: ActionState, info: FileInfo) -> Result<Mod
}; };
tracing::trace!(?image); tracing::trace!(?image);
tracing::debug!(root, ?mod_cfg);
tracing::trace!("Creating mods directory {}", dest.display());
fs::create_dir_all(&dest)
.await
.wrap_err_with(|| format!("Failed to create data directory '{}'", dest.display()))?;
let packages = if mod_cfg.bundled { let packages = if mod_cfg.bundled {
extract_bundled_mod(&mut archive, root, &mod_dir).wrap_err("Failed to extract mod")? extract_bundled_mod(&mut archive, root, &mod_dir).wrap_err("Failed to extract mod")?