mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-10 04:22:13 +10:00
@ -172,7 +172,7 @@ pub fn download_game_bucket(
|
||||
let raw_res = response.text().map_err(|e| {
|
||||
ApplicationDownloadError::Communication(RemoteAccessError::FetchError(e.into()))
|
||||
})?;
|
||||
info!("{}", raw_res);
|
||||
info!("{raw_res}");
|
||||
if let Ok(err) = serde_json::from_str::<DropServerError>(&raw_res) {
|
||||
return Err(ApplicationDownloadError::Communication(
|
||||
RemoteAccessError::InvalidResponse(err),
|
||||
@ -196,8 +196,7 @@ pub fn download_game_bucket(
|
||||
let length = raw_length.parse::<usize>().unwrap_or(0);
|
||||
let Some(drop) = bucket.drops.get(i) else {
|
||||
warn!(
|
||||
"invalid number of Content-Lengths recieved: {}, {}",
|
||||
i, lengths
|
||||
"invalid number of Content-Lengths recieved: {i}, {lengths}"
|
||||
);
|
||||
return Err(ApplicationDownloadError::DownloadError);
|
||||
};
|
||||
|
||||
@ -65,7 +65,6 @@ use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::panic::PanicHookInfo;
|
||||
use std::path::Path;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use std::time::SystemTime;
|
||||
@ -110,13 +109,7 @@ fn create_new_compat_info() -> Option<CompatInfo> {
|
||||
#[cfg(target_os = "windows")]
|
||||
return None;
|
||||
|
||||
let has_umu_installed = Command::new(UMU_LAUNCHER_EXECUTABLE)
|
||||
.stdout(Stdio::null())
|
||||
.spawn();
|
||||
if let Err(umu_error) = &has_umu_installed {
|
||||
warn!("disabling windows support with error: {umu_error}");
|
||||
}
|
||||
let has_umu_installed = has_umu_installed.is_ok();
|
||||
let has_umu_installed = UMU_LAUNCHER_EXECUTABLE.is_some();
|
||||
Some(CompatInfo {
|
||||
umu_installed: has_umu_installed,
|
||||
})
|
||||
|
||||
@ -1,4 +1,11 @@
|
||||
use log::debug;
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::PathBuf,
|
||||
process::{Command, Stdio},
|
||||
sync::LazyLock,
|
||||
};
|
||||
|
||||
use log::{debug, info};
|
||||
|
||||
use crate::{
|
||||
AppState,
|
||||
@ -24,7 +31,31 @@ impl ProcessHandler for NativeGameLauncher {
|
||||
}
|
||||
}
|
||||
|
||||
pub const UMU_LAUNCHER_EXECUTABLE: &str = "umu-run";
|
||||
pub static UMU_LAUNCHER_EXECUTABLE: LazyLock<Option<PathBuf>> = LazyLock::new(|| {
|
||||
let x = get_umu_executable();
|
||||
info!("{:?}", &x);
|
||||
x
|
||||
});
|
||||
const UMU_BASE_LAUNCHER_EXECUTABLE: &str = "umu-run";
|
||||
const UMU_INSTALL_DIRS: [&str; 4] = ["/app/share", "/use/local/share", "/usr/share", "/opt"];
|
||||
|
||||
fn get_umu_executable() -> Option<PathBuf> {
|
||||
if check_executable_exists(UMU_BASE_LAUNCHER_EXECUTABLE) {
|
||||
return Some(PathBuf::from(UMU_BASE_LAUNCHER_EXECUTABLE));
|
||||
}
|
||||
|
||||
for dir in UMU_INSTALL_DIRS {
|
||||
let p = PathBuf::from(dir).join(UMU_BASE_LAUNCHER_EXECUTABLE);
|
||||
if check_executable_exists(&p) {
|
||||
return Some(p);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
fn check_executable_exists<P: AsRef<OsStr>>(exec: P) -> bool {
|
||||
let has_umu_installed = Command::new(exec).stdout(Stdio::null()).output();
|
||||
has_umu_installed.is_ok()
|
||||
}
|
||||
pub struct UMULauncher;
|
||||
impl ProcessHandler for UMULauncher {
|
||||
fn create_launch_process(
|
||||
@ -47,8 +78,8 @@ impl ProcessHandler for UMULauncher {
|
||||
None => game_version.game_id.clone(),
|
||||
};
|
||||
format!(
|
||||
"GAMEID={game_id} {umu} \"{launch}\" {args}",
|
||||
umu = UMU_LAUNCHER_EXECUTABLE,
|
||||
"GAMEID={game_id} {umu:?} \"{launch}\" {args}",
|
||||
umu = UMU_LAUNCHER_EXECUTABLE.as_ref().unwrap(),
|
||||
launch = launch_command,
|
||||
args = args.join(" ")
|
||||
)
|
||||
@ -80,7 +111,10 @@ impl ProcessHandler for AsahiMuvmLauncher {
|
||||
game_version,
|
||||
current_dir,
|
||||
);
|
||||
let mut args_cmd = umu_string.split("umu-run").collect::<Vec<&str>>().into_iter();
|
||||
let mut args_cmd = umu_string
|
||||
.split("umu-run")
|
||||
.collect::<Vec<&str>>()
|
||||
.into_iter();
|
||||
let args = args_cmd.next().unwrap().trim();
|
||||
let cmd = format!("umu-run{}", args_cmd.next().unwrap());
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ pub fn auth_initiate_code(app: AppHandle) -> Result<String, RemoteAccessError> {
|
||||
let code = auth_initiate_logic("code".to_string())?;
|
||||
let header_code = code.clone();
|
||||
|
||||
println!("using code: {} to sign in", code);
|
||||
println!("using code: {code} to sign in");
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let load = async || -> Result<(), RemoteAccessError> {
|
||||
|
||||
Reference in New Issue
Block a user