You've already forked AstralRinth
forked from didirus/AstralRinth
Fix forever installing (#3135)
* Rough draft for fix for Mojang servers being down causing infinite installation * Add "pack installed" install step * Allow repairing an instance from Library to recover pack contents * Allow repair from instance page * Deduplicate repair code * Fix lint * Fix lint (for real this time) --------- Co-authored-by: Jai Agrawal <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::pack::install_from::{
|
||||
};
|
||||
use crate::state::{
|
||||
CacheBehaviour, CachedEntry, Credentials, JavaVersion, ProcessMetadata,
|
||||
ProfileFile, ProjectType, SideType,
|
||||
ProfileFile, ProfileInstallStage, ProjectType, SideType,
|
||||
};
|
||||
|
||||
use crate::event::{emit::emit_profile, ProfilePayloadType};
|
||||
@@ -225,7 +225,18 @@ pub async fn list() -> crate::Result<Vec<Profile>> {
|
||||
#[tracing::instrument]
|
||||
pub async fn install(path: &str, force: bool) -> crate::Result<()> {
|
||||
if let Some(profile) = get(path).await? {
|
||||
crate::launcher::install_minecraft(&profile, None, force).await?;
|
||||
let result =
|
||||
crate::launcher::install_minecraft(&profile, None, force).await;
|
||||
if result.is_err()
|
||||
&& profile.install_stage != ProfileInstallStage::Installed
|
||||
{
|
||||
edit(path, |prof| {
|
||||
prof.install_stage = ProfileInstallStage::NotInstalled;
|
||||
async { Ok(()) }
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
result?;
|
||||
} else {
|
||||
return Err(crate::ErrorKind::UnmanagedProfileError(path.to_string())
|
||||
.as_error());
|
||||
|
||||
@@ -111,7 +111,7 @@ async fn replace_managed_modrinth(
|
||||
ignore_lock: bool,
|
||||
) -> crate::Result<()> {
|
||||
crate::profile::edit(profile_path, |profile| {
|
||||
profile.install_stage = ProfileInstallStage::Installing;
|
||||
profile.install_stage = ProfileInstallStage::MinecraftInstalling;
|
||||
async { Ok(()) }
|
||||
})
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user