Compare commits

..

2 commits

Author SHA1 Message Date
a0fe5d3f81
nexusmods: Fix File type
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
2023-11-29 15:37:37 +01:00
2ad3fd0fc1
dtmm: Fix importing from .mod file 2023-11-29 15:31:05 +01:00
3 changed files with 23 additions and 3 deletions

View file

@ -234,6 +234,8 @@ fn extract_mod_config<R: Read + Seek>(archive: &mut ZipArchive<R>) -> Result<(Mo
None
};
tracing::debug!(?legacy_mod_data);
if let Some(name) = find_archive_file(archive, "dtmt.cfg") {
let mut f = archive
.by_name(&name)
@ -266,6 +268,24 @@ fn extract_mod_config<R: Read + Seek>(archive: &mut ZipArchive<R>) -> Result<(Mo
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 {
eyre::bail!(
"Mod needs a config file or `.mod` file. \

View file

@ -117,7 +117,7 @@ impl Api {
let Some(file) = files
.files
.into_iter()
.find(|file| file.updated_timestamp == timestamp)
.find(|file| file.uploaded_timestamp == timestamp)
else {
let err = Error::Custom("Timestamp does not match any file".into());
return Err(err);

View file

@ -77,13 +77,13 @@ pub struct File {
pub size: u64,
pub file_name: String,
#[serde(with = "time::serde::timestamp")]
pub updated_timestamp: OffsetDateTime,
pub uploaded_timestamp: OffsetDateTime,
pub mod_version: String,
pub external_virus_scan_url: String,
pub description: String,
pub size_kb: u64,
pub size_in_bytes: u64,
pub changelog_html: String,
pub changelog_html: Option<String>,
pub content_preview_link: String,
}