You've already forked AstralRinth
forked from didirus/AstralRinth
Beta bugs (#562)
* fixed bugs * added logging for atlauncher * draft: improving imports time * more improvements * more * prettier, etc * small changes * emma suggested change * rev * removed atlauncher debug
This commit is contained in:
@@ -32,6 +32,7 @@ pub async fn profile_create(
|
||||
icon_url: Option<String>, // the URL icon for a profile (ONLY USED FOR TEMPORARY PROFILES)
|
||||
linked_data: Option<LinkedData>, // the linked project ID (mainly for modpacks)- used for updating
|
||||
skip_install_profile: Option<bool>,
|
||||
no_watch: Option<bool>,
|
||||
) -> crate::Result<ProfilePathId> {
|
||||
name = profile::sanitize_profile_name(&name);
|
||||
|
||||
@@ -112,7 +113,9 @@ pub async fn profile_create(
|
||||
|
||||
{
|
||||
let mut profiles = state.profiles.write().await;
|
||||
profiles.insert(profile.clone()).await?;
|
||||
profiles
|
||||
.insert(profile.clone(), no_watch.unwrap_or_default())
|
||||
.await?;
|
||||
}
|
||||
|
||||
if !skip_install_profile.unwrap_or(false) {
|
||||
@@ -146,6 +149,7 @@ pub async fn profile_create_from_creator(
|
||||
profile.icon_url,
|
||||
profile.linked_data,
|
||||
profile.skip_install_profile,
|
||||
profile.no_watch,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ pub async fn create_mrpack_json(
|
||||
// But the values are sanitized to only include the version number
|
||||
let dependencies = dependencies
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, sanitize_loader_version_string(&v).to_string()))
|
||||
.map(|(k, v)| (k, sanitize_loader_version_string(&v, k).to_string()))
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
let files: Result<Vec<PackFile>, crate::ErrorKind> = profile
|
||||
@@ -1043,18 +1043,26 @@ pub async fn create_mrpack_json(
|
||||
})
|
||||
}
|
||||
|
||||
fn sanitize_loader_version_string(s: &str) -> &str {
|
||||
// Split on '-'
|
||||
// If two or more, take the second
|
||||
// If one, take the first
|
||||
// If none, take the whole thing
|
||||
let mut split: std::str::Split<'_, char> = s.split('-');
|
||||
match split.next() {
|
||||
Some(first) => match split.next() {
|
||||
Some(second) => second,
|
||||
None => first,
|
||||
},
|
||||
None => s,
|
||||
fn sanitize_loader_version_string(s: &str, loader: PackDependency) -> &str {
|
||||
match loader {
|
||||
// Split on '-'
|
||||
// If two or more, take the second
|
||||
// If one, take the first
|
||||
// If none, take the whole thing
|
||||
PackDependency::Forge => {
|
||||
let mut split: std::str::Split<'_, char> = s.split('-');
|
||||
match split.next() {
|
||||
Some(first) => match split.next() {
|
||||
Some(second) => second,
|
||||
None => first,
|
||||
},
|
||||
None => s,
|
||||
}
|
||||
}
|
||||
// For quilt, etc we take the whole thing, as it functions like: 0.20.0-beta.11 (and should not be split here)
|
||||
PackDependency::QuiltLoader
|
||||
| PackDependency::FabricLoader
|
||||
| PackDependency::Minecraft => s,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user