&* is simply just bad. let deref coercion figure it out
This commit is contained in:
parent
6b11613b99
commit
596ca8ab4f
@ -73,12 +73,12 @@ impl Metadata {
|
|||||||
|
|
||||||
pub async fn fetch() -> Result<Self, DataError> {
|
pub async fn fetch() -> Result<Self, DataError> {
|
||||||
let (game, forge, fabric) = futures::future::join3(
|
let (game, forge, fabric) = futures::future::join3(
|
||||||
daedalus::minecraft::fetch_version_manifest(Some(&*format!(
|
daedalus::minecraft::fetch_version_manifest(Some(&format!(
|
||||||
"{}/minecraft/v0/manifest.json",
|
"{}/minecraft/v0/manifest.json",
|
||||||
META_URL
|
META_URL
|
||||||
))),
|
))),
|
||||||
daedalus::modded::fetch_manifest(&*format!("{}/forge/v0/manifest.json", META_URL)),
|
daedalus::modded::fetch_manifest(&format!("{}/forge/v0/manifest.json", META_URL)),
|
||||||
daedalus::modded::fetch_manifest(&*format!("{}/fabric/v0/manifest.json", META_URL)),
|
daedalus::modded::fetch_manifest(&format!("{}/fabric/v0/manifest.json", META_URL)),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ impl Settings {
|
|||||||
|
|
||||||
if settings_path.exists() {
|
if settings_path.exists() {
|
||||||
let settings_data = std::fs::read_to_string(settings_path)
|
let settings_data = std::fs::read_to_string(settings_path)
|
||||||
.map(|x| serde_json::from_str::<Settings>(&*x).ok())
|
.map(|x| serde_json::from_str::<Settings>(&x).ok())
|
||||||
.ok()
|
.ok()
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ impl Settings {
|
|||||||
|
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
Path::new(LAUNCHER_WORK_DIR).join(SETTINGS_FILE),
|
Path::new(LAUNCHER_WORK_DIR).join(SETTINGS_FILE),
|
||||||
&*serde_json::to_string(&new)?,
|
&serde_json::to_string(&new)?,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
SETTINGS.get_or_init(|| RwLock::new(new));
|
SETTINGS.get_or_init(|| RwLock::new(new));
|
||||||
|
|||||||
@ -108,7 +108,7 @@ pub fn get_jvm_arguments(
|
|||||||
} else {
|
} else {
|
||||||
parsed_arguments.push(format!(
|
parsed_arguments.push(format!(
|
||||||
"-Djava.library.path={}",
|
"-Djava.library.path={}",
|
||||||
&*crate::util::absolute_path(natives_path)
|
&crate::util::absolute_path(natives_path)
|
||||||
.map_err(|_| LauncherError::InvalidInput(format!(
|
.map_err(|_| LauncherError::InvalidInput(format!(
|
||||||
"Specified natives path {} does not exist",
|
"Specified natives path {} does not exist",
|
||||||
natives_path.to_string_lossy()
|
natives_path.to_string_lossy()
|
||||||
@ -153,7 +153,7 @@ fn parse_jvm_argument(
|
|||||||
)
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"${library_directory}",
|
"${library_directory}",
|
||||||
&*crate::util::absolute_path(libraries_path)
|
&crate::util::absolute_path(libraries_path)
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
LauncherError::InvalidInput(format!(
|
LauncherError::InvalidInput(format!(
|
||||||
"Specified libraries path {} does not exist",
|
"Specified libraries path {} does not exist",
|
||||||
@ -240,14 +240,14 @@ fn parse_minecraft_argument(
|
|||||||
.replace("${auth_access_token}", access_token)
|
.replace("${auth_access_token}", access_token)
|
||||||
.replace("${auth_session}", access_token)
|
.replace("${auth_session}", access_token)
|
||||||
.replace("${auth_player_name}", username)
|
.replace("${auth_player_name}", username)
|
||||||
.replace("${auth_uuid}", &*uuid.to_hyphenated().to_string())
|
.replace("${auth_uuid}", &uuid.to_hyphenated().to_string())
|
||||||
.replace("${user_properties}", "{}")
|
.replace("${user_properties}", "{}")
|
||||||
.replace("${user_type}", "mojang")
|
.replace("${user_type}", "mojang")
|
||||||
.replace("${version_name}", version)
|
.replace("${version_name}", version)
|
||||||
.replace("${assets_index_name}", asset_index_name)
|
.replace("${assets_index_name}", asset_index_name)
|
||||||
.replace(
|
.replace(
|
||||||
"${game_directory}",
|
"${game_directory}",
|
||||||
&*crate::util::absolute_path(game_directory)
|
&crate::util::absolute_path(game_directory)
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
LauncherError::InvalidInput(format!(
|
LauncherError::InvalidInput(format!(
|
||||||
"Specified game directory {} does not exist",
|
"Specified game directory {} does not exist",
|
||||||
@ -259,7 +259,7 @@ fn parse_minecraft_argument(
|
|||||||
)
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"${assets_root}",
|
"${assets_root}",
|
||||||
&*crate::util::absolute_path(assets_directory)
|
&crate::util::absolute_path(assets_directory)
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
LauncherError::InvalidInput(format!(
|
LauncherError::InvalidInput(format!(
|
||||||
"Specified assets directory {} does not exist",
|
"Specified assets directory {} does not exist",
|
||||||
@ -271,7 +271,7 @@ fn parse_minecraft_argument(
|
|||||||
)
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"${game_assets}",
|
"${game_assets}",
|
||||||
&*crate::util::absolute_path(assets_directory)
|
&crate::util::absolute_path(assets_directory)
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
LauncherError::InvalidInput(format!(
|
LauncherError::InvalidInput(format!(
|
||||||
"Specified assets directory {} does not exist",
|
"Specified assets directory {} does not exist",
|
||||||
@ -282,8 +282,8 @@ fn parse_minecraft_argument(
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
)
|
)
|
||||||
.replace("${version_type}", version_type.as_str())
|
.replace("${version_type}", version_type.as_str())
|
||||||
.replace("${resolution_width}", &*resolution.0.to_string())
|
.replace("${resolution_width}", &resolution.0.to_string())
|
||||||
.replace("${resolution_height}", &*resolution.1.to_string()))
|
.replace("${resolution_height}", &resolution.1.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_arguments<F>(
|
fn parse_arguments<F>(
|
||||||
|
|||||||
@ -270,7 +270,7 @@ pub async fn download_file(url: &str, sha1: Option<&str>) -> Result<bytes::Bytes
|
|||||||
|
|
||||||
if let Ok(bytes) = bytes {
|
if let Ok(bytes) = bytes {
|
||||||
if let Some(sha1) = sha1 {
|
if let Some(sha1) = sha1 {
|
||||||
if &*get_hash(bytes.clone()).await? != sha1 {
|
if &get_hash(bytes.clone()).await? != sha1 {
|
||||||
if attempt <= 3 {
|
if attempt <= 3 {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -259,7 +259,7 @@ pub async fn launch_minecraft(
|
|||||||
|
|
||||||
if !child.status.success() {
|
if !child.status.success() {
|
||||||
return Err(LauncherError::ProcessorError(
|
return Err(LauncherError::ProcessorError(
|
||||||
String::from_utf8_lossy(&*child.stderr).to_string(),
|
String::from_utf8_lossy(&child.stderr).to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ pub async fn launch_minecraft(
|
|||||||
arguments.get(&ArgumentType::Jvm).map(|x| x.as_slice()),
|
arguments.get(&ArgumentType::Jvm).map(|x| x.as_slice()),
|
||||||
&natives_path,
|
&natives_path,
|
||||||
&libraries_path,
|
&libraries_path,
|
||||||
&*args::get_class_paths(&libraries_path, version.libraries.as_slice(), &client_path)?,
|
&args::get_class_paths(&libraries_path, version.libraries.as_slice(), &client_path)?,
|
||||||
&version_jar_name,
|
&version_jar_name,
|
||||||
settings.memory,
|
settings.memory,
|
||||||
settings
|
settings
|
||||||
@ -298,7 +298,7 @@ pub async fn launch_minecraft(
|
|||||||
arguments.get(&ArgumentType::Game).map(|x| x.as_slice()),
|
arguments.get(&ArgumentType::Game).map(|x| x.as_slice()),
|
||||||
version.minecraft_arguments.as_deref(),
|
version.minecraft_arguments.as_deref(),
|
||||||
credentials,
|
credentials,
|
||||||
&*version.id,
|
&version.id,
|
||||||
&version.asset_index.id,
|
&version.asset_index.id,
|
||||||
root_dir,
|
root_dir,
|
||||||
&assets_path,
|
&assets_path,
|
||||||
|
|||||||
@ -45,7 +45,7 @@ pub fn parse_os_rule(rule: &OsRule) -> bool {
|
|||||||
let regex = Regex::new(version.as_str());
|
let regex = Regex::new(version.as_str());
|
||||||
|
|
||||||
if let Ok(regex) = regex {
|
if let Ok(regex) = regex {
|
||||||
if !regex.is_match(&*sys_info::os_release().unwrap_or_default()) {
|
if !regex.is_match(&sys_info::os_release().unwrap_or_default()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,2 @@
|
|||||||
use theseus::launcher::{Credentials, ModLoader};
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {}
|
async fn main() {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user