chore: run osu detached

This commit is contained in:
HorizonCode 2025-07-04 08:03:09 +02:00
parent 40795ad6d9
commit d7015d6252

View File

@ -317,10 +317,19 @@ pub fn run_osu_updater(folder: String) -> Result<(), String> {
#[tauri::command] #[tauri::command]
pub fn run_osu(folder: String) -> Result<(), String> { pub fn run_osu(folder: String) -> Result<(), String> {
let osu_exe_path = PathBuf::from(folder).join("osu!.exe"); let osu_exe_path = PathBuf::from(folder).join("osu!.exe");
#[cfg(windows)]
const DETACHED_PROCESS: u32 = 0x00000008;
#[cfg(windows)]
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
#[cfg(windows)]
let mut game_process = Command::new(osu_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| e.to_string())?;
#[cfg(not(windows))]
let mut game_process = Command::new(osu_exe_path) let mut game_process = Command::new(osu_exe_path)
.arg("-devserver")
.arg("ez-pp.farm")
.spawn() .spawn()
.map_err(|e| e.to_string())?; .map_err(|e| e.to_string())?;