Bug fixes round 3 (#298)

* fixed bugs

* title case

* bugs; ioerror

* reset breadcrumbs

* more fixes

* more fixes

* scrolling bug

* more fixes

* more fixes

* clippy

* canonicalize fix

* fixed requested changes

* removed debouncer update
This commit is contained in:
Wyatt Verchere
2023-07-19 14:13:25 -07:00
committed by GitHub
parent 6650cc9ce4
commit 1f478ec9fc
34 changed files with 932 additions and 602 deletions

View File

@@ -1,9 +1,10 @@
//! Logic for launching Minecraft
use crate::event::emit::{emit_loading, init_or_edit_loading};
use crate::event::{LoadingBarId, LoadingBarType};
use crate::jre::{JAVA_17_KEY, JAVA_18PLUS_KEY, JAVA_8_KEY};
use crate::jre::{self, JAVA_17_KEY, JAVA_18PLUS_KEY, JAVA_8_KEY};
use crate::prelude::JavaVersion;
use crate::state::ProfileInstallStage;
use crate::util::io;
use crate::EventState;
use crate::{
process,
@@ -13,10 +14,8 @@ use crate::{
use chrono::Utc;
use daedalus as d;
use daedalus::minecraft::VersionInfo;
use dunce::canonicalize;
use st::Profile;
use std::collections::HashMap;
use std::fs;
use std::{process::Stdio, sync::Arc};
use tokio::process::Command;
use uuid::Uuid;
@@ -125,7 +124,7 @@ pub async fn install_minecraft(
State::sync().await?;
let state = State::get().await?;
let instance_path = &canonicalize(&profile.path)?;
let instance_path = &io::canonicalize(&profile.path)?;
let metadata = state.metadata.read().await;
let version = metadata
@@ -160,7 +159,7 @@ pub async fn install_minecraft(
.await?
.ok_or_else(|| {
crate::ErrorKind::OtherError(
"No available java installation".to_string(),
"Missing correct java installation".to_string(),
)
})?;
@@ -282,7 +281,7 @@ pub async fn install_minecraft(
Ok(())
}
#[tracing::instrument]
#[tracing::instrument(skip_all)]
#[theseus_macros::debug_pin]
#[allow(clippy::too_many_arguments)]
pub async fn launch_minecraft(
@@ -310,7 +309,7 @@ pub async fn launch_minecraft(
let state = State::get().await?;
let metadata = state.metadata.read().await;
let instance_path = &canonicalize(&profile.path)?;
let instance_path = &io::canonicalize(&profile.path)?;
let version = metadata
.minecraft
@@ -343,10 +342,20 @@ pub async fn launch_minecraft(
.await?
.ok_or_else(|| {
crate::ErrorKind::LauncherError(
"No available java installation".to_string(),
"Missing correct java installation".to_string(),
)
})?;
// Test jre version
let java_version = jre::check_jre(java_version.path.clone().into())
.await?
.ok_or_else(|| {
crate::ErrorKind::LauncherError(format!(
"Java path invalid or non-functional: {}",
java_version.path
))
})?;
let client_path = state
.directories
.version_dir(&version_jar)
@@ -433,7 +442,7 @@ pub async fn launch_minecraft(
.profile_logs_dir(profile.uuid)
.join(&datetime_string)
};
fs::create_dir_all(&logs_dir)?;
io::create_dir_all(&logs_dir).await?;
let stdout_log_path = logs_dir.join("stdout.log");