diff options
Diffstat (limited to 'src-tauri/src/northstar/install.rs')
-rw-r--r-- | src-tauri/src/northstar/install.rs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index a89de018..0953fa38 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -4,7 +4,7 @@ use std::time::Duration; use std::{cell::RefCell, time::Instant}; use ts_rs::TS; -use crate::constants::{CORE_MODS, NORTHSTAR_DEFAULT_PROFILE, NORTHSTAR_DLL, TITANFALL2_STEAM_ID}; +use crate::constants::{CORE_MODS, NORTHSTAR_DEFAULT_PROFILE, NORTHSTAR_DLL}; use crate::{ util::{extract, move_dir_all}, GameInstall, InstallType, @@ -293,7 +293,7 @@ pub async fn install_northstar( pub fn find_game_install_location() -> Result<GameInstall, String> { // Attempt parsing Steam library directly match steamlocate::SteamDir::locate() { - Some(mut steamdir) => { + Ok(steamdir) => { #[cfg(target_os = "linux")] { let snap_dir = match std::env::var("SNAP_USER_DATA") { @@ -305,26 +305,37 @@ pub fn find_game_install_location() -> Result<GameInstall, String> { .join("snap"), }; - if steamdir.path.starts_with(snap_dir) { + if steamdir.path().starts_with(snap_dir) { log::warn!("Found Steam installed via Snap, you may encounter issues"); } } - let titanfall2_steamid = TITANFALL2_STEAM_ID.parse().unwrap(); - match steamdir.app(&titanfall2_steamid) { - Some(app) => { - // println!("{:#?}", app); + match steamdir.find_app(thermite::TITANFALL2_STEAM_ID) { + Ok(Some((app, library))) => { + let app_path = library + .path() + .join("steamapps") + .join("common") + .join(app.install_dir) + .into_os_string() + .into_string() + .unwrap(); + let game_install = GameInstall { - game_path: app.path.to_str().unwrap().to_string(), + game_path: app_path, profile: "R2Northstar".to_string(), install_type: InstallType::STEAM, }; return Ok(game_install); } - None => log::info!("Couldn't locate Titanfall2 Steam install"), + Ok(None) => log::info!("Couldn't locate your Titanfall 2 Steam install."), + Err(err) => log::info!( + "Something went wrong while trying to find Titanfall 2 {}", + err + ), } } - None => log::info!("Couldn't locate Steam on this computer!"), + Err(err) => log::info!("Couldn't locate Steam on this computer! {}", err), } // (On Windows only) try parsing Windows registry for Origin install path |