fix(runtime): validate and repair launch caches
This commit is contained in:
1 parent
1079680513
commit
a25f7d20c8
8 files changed
+301
-131
No files matched your search
@@ -48,6 +48,26 @@ impl ModLoaderInstaller for ForgeInstaller {
|
||||
loader_version: &str,
|
||||
instance_dir: &Path,
|
||||
meta_dir: &Path,
|
||||
) -> Result<(), InstallError> {
|
||||
self.install_with_java(
|
||||
client,
|
||||
game_version,
|
||||
loader_version,
|
||||
instance_dir,
|
||||
meta_dir,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn install_with_java(
|
||||
&self,
|
||||
client: &HttpClient,
|
||||
game_version: &str,
|
||||
loader_version: &str,
|
||||
instance_dir: &Path,
|
||||
meta_dir: &Path,
|
||||
java_path: Option<&str>,
|
||||
) -> Result<(), InstallError> {
|
||||
let installer_jar = instance_dir
|
||||
.join(crate::storage::MINECRAFT_DIR_NAME)
|
||||
@@ -76,12 +96,14 @@ impl ModLoaderInstaller for ForgeInstaller {
|
||||
}
|
||||
} else {
|
||||
// modern forge: run the java installer
|
||||
let java_path = crate::config::SETTINGS
|
||||
.read()
|
||||
.paths
|
||||
.effective_java_path()
|
||||
.map(str::to_owned)
|
||||
.unwrap_or_else(crate::instance::java::detect_java_path);
|
||||
let java_path = java_path.map(str::to_owned).unwrap_or_else(|| {
|
||||
crate::config::SETTINGS
|
||||
.read()
|
||||
.paths
|
||||
.effective_java_path()
|
||||
.map(str::to_owned)
|
||||
.unwrap_or_else(crate::instance::java::detect_java_path)
|
||||
});
|
||||
tracing::debug!("Running Forge installer with Java {}", java_path);
|
||||
if let Err(e) = run_forge_installer(&installer_jar, instance_dir, &java_path).await {
|
||||
let _ = tokio::fs::remove_file(&installer_jar).await;
|
||||
|
||||
Reference in new issue
Block a user