Implement non-bundled mods #125
3 changed files with 7 additions and 10 deletions
|
@ -154,7 +154,7 @@ impl Api {
|
||||||
self.mods_download_link(nxm.mod_id, nxm.file_id, nxm.key, nxm.expires)
|
self.mods_download_link(nxm.mod_id, nxm.file_id, nxm.key, nxm.expires)
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let Some(download_url) = download_info.get(0).map(|i| i.uri.clone()) else {
|
let Some(download_url) = download_info.first().map(|i| i.uri.clone()) else {
|
||||||
return Err(Error::InvalidNXM("no download link", url));
|
return Err(Error::InvalidNXM("no download link", url));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -227,13 +227,10 @@ impl Bundle {
|
||||||
let _enter = span.enter();
|
let _enter = span.enter();
|
||||||
tracing::trace!(num_files = self.files.len());
|
tracing::trace!(num_files = self.files.len());
|
||||||
|
|
||||||
self.files
|
self.files.iter().try_fold(Vec::new(), |mut data, file| {
|
||||||
.iter()
|
data.append(&mut file.to_binary()?);
|
||||||
.fold(Ok::<Vec<u8>, Report>(Vec::new()), |data, file| {
|
Ok::<_, Report>(data)
|
||||||
let mut data = data?;
|
})?
|
||||||
data.append(&mut file.to_binary()?);
|
|
||||||
Ok(data)
|
|
||||||
})?
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ceiling division (or division toward infinity) to calculate
|
// Ceiling division (or division toward infinity) to calculate
|
||||||
|
|
|
@ -53,8 +53,8 @@ where
|
||||||
|
|
||||||
let mut buf = vec![0u8; length];
|
let mut buf = vec![0u8; length];
|
||||||
r.read_exact(&mut buf)?;
|
r.read_exact(&mut buf)?;
|
||||||
let mut s = String::from_utf8(buf)
|
let mut s =
|
||||||
.wrap_err_with(|| format!("Invalid byte sequence for LuaJIT bytecode name"))?;
|
String::from_utf8(buf).wrap_err("Invalid byte sequence for LuaJIT bytecode name")?;
|
||||||
// Remove the leading `@`
|
// Remove the leading `@`
|
||||||
s.remove(0);
|
s.remove(0);
|
||||||
s
|
s
|
||||||
|
|
Loading…
Add table
Reference in a new issue