You've already forked AstralRinth
forked from didirus/AstralRinth
Bump version + Fix partial version and full version argument joining
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daedalus"
|
name = "daedalus"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ pub struct PartialVersionInfo {
|
|||||||
pub time: DateTime<Utc>,
|
pub time: DateTime<Utc>,
|
||||||
/// The classpath to the main class to launch the game
|
/// The classpath to the main class to launch the game
|
||||||
pub main_class: Option<String>,
|
pub main_class: Option<String>,
|
||||||
|
/// (Legacy) Arguments passed to the game
|
||||||
|
pub minecraft_arguments: Option<String>,
|
||||||
/// Arguments passed to the game or JVM
|
/// Arguments passed to the game or JVM
|
||||||
pub arguments: Option<HashMap<ArgumentType, Vec<Argument>>>,
|
pub arguments: Option<HashMap<ArgumentType, Vec<Argument>>>,
|
||||||
/// Libraries that the version depends on
|
/// Libraries that the version depends on
|
||||||
@@ -72,7 +74,24 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
|
|||||||
VersionInfo {
|
VersionInfo {
|
||||||
arguments: if let Some(partial_args) = partial.arguments {
|
arguments: if let Some(partial_args) = partial.arguments {
|
||||||
if let Some(merge_args) = merge.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 {
|
} else {
|
||||||
Some(partial_args)
|
Some(partial_args)
|
||||||
}
|
}
|
||||||
@@ -93,7 +112,7 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
|
|||||||
} else {
|
} else {
|
||||||
merge.main_class
|
merge.main_class
|
||||||
},
|
},
|
||||||
minecraft_arguments: merge.minecraft_arguments,
|
minecraft_arguments: partial.minecraft_arguments,
|
||||||
minimum_launcher_version: merge.minimum_launcher_version,
|
minimum_launcher_version: merge.minimum_launcher_version,
|
||||||
release_time: partial.release_time,
|
release_time: partial.release_time,
|
||||||
time: partial.time,
|
time: partial.time,
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ pub async fn retrieve_data(uploaded_files: &mut Vec<String>) -> Result<(), Error
|
|||||||
type_: version.type_,
|
type_: version.type_,
|
||||||
inherits_from: version.inherits_from,
|
inherits_from: version.inherits_from,
|
||||||
libraries: libs,
|
libraries: libs,
|
||||||
|
minecraft_arguments: version.minecraft_arguments,
|
||||||
processors: None,
|
processors: None,
|
||||||
data: 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,
|
release_time: profile.version_info.release_time,
|
||||||
time: profile.version_info.time,
|
time: profile.version_info.time,
|
||||||
main_class: profile.version_info.main_class,
|
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()),
|
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,
|
libraries: libs,
|
||||||
type_: profile.version_info.type_,
|
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,
|
release_time: version_info.release_time,
|
||||||
time: version_info.time,
|
time: version_info.time,
|
||||||
main_class: version_info.main_class,
|
main_class: version_info.main_class,
|
||||||
|
minecraft_arguments: version_info.minecraft_arguments,
|
||||||
arguments: version_info.arguments,
|
arguments: version_info.arguments,
|
||||||
libraries: libs,
|
libraries: libs,
|
||||||
type_: version_info.type_,
|
type_: version_info.type_,
|
||||||
|
|||||||
Reference in New Issue
Block a user