Add classpath variable for libraries

This commit is contained in:
Jai A
2021-11-10 17:34:53 -07:00
parent 0990ac4fc1
commit f6c611bbba
3 changed files with 21 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "daedalus"
version = "0.1.5"
version = "0.1.6"
authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018"
license = "MIT"

View File

@@ -252,6 +252,13 @@ pub struct Library {
#[serde(skip_serializing_if = "Option::is_none")]
/// SHA1 Checksums for validating the library's integrity. Only present for forge libraries
pub checksums: Option<Vec<String>>,
#[serde(default = "default_include_in_classpath")]
/// Whether the library should be included in the classpath at the game's launch
pub include_in_classpath: bool,
}
fn default_include_in_classpath() -> bool {
true
}
#[derive(Serialize, Deserialize, Debug, Clone)]

View File

@@ -230,7 +230,16 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
}).await??;
let mut libs : Vec<daedalus::minecraft::Library> = profile.libraries.into_iter().chain(version_info.libraries).collect();
let mut libs : Vec<daedalus::minecraft::Library> = version_info.libraries.into_iter().chain(profile.libraries.into_iter().map(|x| Library {
downloads: x.downloads,
extract: x.extract,
name: x.name,
url: x.url,
natives: x.natives,
rules: x.rules,
checksums: x.checksums,
include_in_classpath: false
})).collect();
let mut local_libs : HashMap<String, bytes::Bytes> = HashMap::new();
@@ -286,7 +295,8 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
url: Some("".to_string()),
natives: None,
rules: None,
checksums: None
checksums: None,
include_in_classpath: false,
});
}
}
@@ -321,7 +331,7 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
artifact.url = format_url(&*format!("maven/{}", artifact_path));
}
} else if lib.url.is_some() {
lib.url = Some(format_url(&*format!("maven/{}", artifact_path)));
lib.url = Some(format_url("maven/"));
}
return Ok::<Library, Error>(lib);