Fix various issues (#123)

* Fix various issues

* Remove unused
This commit is contained in:
Geometrically
2023-05-23 14:24:39 -07:00
committed by GitHub
parent 8ff1b0d108
commit 9ea548cfe3
16 changed files with 47 additions and 40 deletions

View File

@@ -18,7 +18,6 @@ pub async fn get() -> crate::Result<Settings> {
#[tracing::instrument]
pub async fn set(settings: Settings) -> crate::Result<()> {
let state = State::get().await?;
// Replaces the settings struct in the RwLock with the passed argument
let (reset_io, reset_fetch) = async {
let read = state.settings.read().await;
(
@@ -28,13 +27,17 @@ pub async fn set(settings: Settings) -> crate::Result<()> {
}
.await;
*state.settings.write().await = settings;
{
*state.settings.write().await = settings;
}
if reset_io {
state.reset_io_semaphore().await;
}
if reset_fetch {
state.reset_fetch_semaphore().await;
}
State::sync().await?;
Ok(())
}

View File

@@ -149,7 +149,7 @@ pub async fn install_minecraft(
let java_version = get_java_version_from_profile(profile, &version_info)
.await?
.ok_or_else(|| {
crate::ErrorKind::LauncherError(
crate::ErrorKind::OtherError(
"No available java installation".to_string(),
)
})?;

View File

@@ -39,8 +39,8 @@ impl Default for Settings {
java_globals: JavaGlobals::new(),
default_user: None,
hooks: Hooks::default(),
max_concurrent_downloads: 64,
max_concurrent_writes: 100,
max_concurrent_downloads: 10,
max_concurrent_writes: 10,
version: CURRENT_FORMAT_VERSION,
collapsed_navigation: false,
}

View File

@@ -221,7 +221,7 @@ async fn get_all_jre_path() -> Result<HashSet<PathBuf>, JREError> {
#[cfg(target_os = "windows")]
#[allow(dead_code)]
const JAVA_BIN: &str = "java.exe";
const JAVA_BIN: &str = "javaw.exe";
#[cfg(not(target_os = "windows"))]
#[allow(dead_code)]