diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-08-08 13:37:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 13:37:48 +0200 |
commit | 4ec7ddd591b025b02588ea29ac420f3b6db14823 (patch) | |
tree | d408656180bc9058a96ccc61fa1b66e9f9a8076f /src-tauri/src/northstar | |
parent | 892a85fe8dde014d8b92030283ace1068525ad99 (diff) | |
parent | 3cab2a7852fdc4663c8c7f4df6a52b831e610e92 (diff) | |
download | FlightCore-4ec7ddd591b025b02588ea29ac420f3b6db14823.tar.gz FlightCore-4ec7ddd591b025b02588ea29ac420f3b6db14823.zip |
Merge branch 'main' into feat/retry-package-index-fetchfeat/retry-package-index-fetch
Diffstat (limited to 'src-tauri/src/northstar')
-rw-r--r-- | src-tauri/src/northstar/install.rs | 28 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 22 |
2 files changed, 34 insertions, 16 deletions
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index 9d9b43d1..89631fdb 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -306,7 +306,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") { @@ -318,25 +318,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"); } } - match steamdir.app(&thermite::TITANFALL2_STEAM_ID) { - 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 diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index 0b37c3f6..4b16f701 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -235,19 +235,25 @@ pub fn launch_northstar_steam(game_install: GameInstall) -> Result<String, Strin } match steamlocate::SteamDir::locate() { - Some(mut steamdir) => { + Ok(steamdir) => { if get_host_os() != "windows" { - match steamdir.compat_tool(&thermite::TITANFALL2_STEAM_ID) { - Some(_) => {} - None => { - return Err( - "Titanfall2 was not configured to use a compatibility tool".to_string() - ); + match steamdir.compat_tool_mapping() { + Ok(map) => match map.get(&thermite::TITANFALL2_STEAM_ID) { + Some(_) => {} + None => { + return Err( + "Titanfall2 was not configured to use a compatibility tool" + .to_string(), + ); + } + }, + Err(_) => { + return Err("Could not get compatibility tool mapping".to_string()); } } } } - None => { + Err(_) => { return Err("Couldn't access Titanfall2 directory".to_string()); } } |