Bump version + Fix partial version and full version argument joining
This commit is contained in:
parent
793e542312
commit
2a7dbda133
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "daedalus"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
||||
@ -33,6 +33,8 @@ pub struct PartialVersionInfo {
|
||||
pub time: DateTime<Utc>,
|
||||
/// The classpath to the main class to launch the game
|
||||
pub main_class: Option<String>,
|
||||
/// (Legacy) Arguments passed to the game
|
||||
pub minecraft_arguments: Option<String>,
|
||||
/// Arguments passed to the game or JVM
|
||||
pub arguments: Option<HashMap<ArgumentType, Vec<Argument>>>,
|
||||
/// Libraries that the version depends on
|
||||
@ -72,7 +74,24 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
|
||||
VersionInfo {
|
||||
arguments: if let Some(partial_args) = partial.arguments {
|
||||
if let Some(merge_args) = merge.arguments {
|
||||
Some(partial_args.into_iter().chain(merge_args).collect())
|
||||
let mut new_map = HashMap::new();
|
||||
|
||||
fn add_keys(new_map: &mut HashMap<ArgumentType, Vec<Argument>>, args: HashMap<ArgumentType, Vec<Argument>>) {
|
||||
for (type_, arguments) in args {
|
||||
for arg in arguments {
|
||||
if let Some(vec) = new_map.get_mut(&type_) {
|
||||
vec.push(arg);
|
||||
} else {
|
||||
new_map.insert(type_, vec![arg]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_keys(&mut new_map, merge_args);
|
||||
add_keys(&mut new_map, partial_args);
|
||||
|
||||
Some(new_map)
|
||||
} else {
|
||||
Some(partial_args)
|
||||
}
|
||||
@ -93,7 +112,7 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
|
||||
} else {
|
||||
merge.main_class
|
||||
},
|
||||
minecraft_arguments: merge.minecraft_arguments,
|
||||
minecraft_arguments: partial.minecraft_arguments,
|
||||
minimum_launcher_version: merge.minimum_launcher_version,
|
||||
release_time: partial.release_time,
|
||||
time: partial.time,
|
||||
|
||||
@ -152,6 +152,7 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
|
||||
type_: version.type_,
|
||||
inherits_from: version.inherits_from,
|
||||
libraries: libs,
|
||||
minecraft_arguments: version.minecraft_arguments,
|
||||
processors: None,
|
||||
data: None,
|
||||
})?,
|
||||
|
||||
@ -174,6 +174,7 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
|
||||
release_time: profile.version_info.release_time,
|
||||
time: profile.version_info.time,
|
||||
main_class: profile.version_info.main_class,
|
||||
minecraft_arguments: profile.version_info.minecraft_arguments.clone(),
|
||||
arguments: profile.version_info.minecraft_arguments.map(|x| [(ArgumentType::Game, x.split(' ').map(|x| Argument::Normal(x.to_string())).collect())].iter().cloned().collect()),
|
||||
libraries: libs,
|
||||
type_: profile.version_info.type_,
|
||||
@ -285,6 +286,7 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
|
||||
release_time: version_info.release_time,
|
||||
time: version_info.time,
|
||||
main_class: version_info.main_class,
|
||||
minecraft_arguments: version_info.minecraft_arguments,
|
||||
arguments: version_info.arguments,
|
||||
libraries: libs,
|
||||
type_: version_info.type_,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user