diff options
author | Jan <sentrycraft123@gmail.com> | 2024-04-15 16:17:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 16:17:54 +0200 |
commit | e67a0c4cd69c9de1d8effdd077eddfffa1125a70 (patch) | |
tree | af19dcae88ede886f4783c7f2d30991c66ea3dc0 /src-tauri/src/northstar | |
parent | 1e2c5db222bd02c9cc9b2b7455123b670b45e8aa (diff) | |
download | FlightCore-e67a0c4cd69c9de1d8effdd077eddfffa1125a70.tar.gz FlightCore-e67a0c4cd69c9de1d8effdd077eddfffa1125a70.zip |
chore: bump steamlocate from 1.2 to 2.0.0-beta.2 (#891)
Gets rid of `steamy_vdf` and other out of date dependencies
Diffstat (limited to 'src-tauri/src/northstar')
-rw-r--r-- | src-tauri/src/northstar/install.rs | 25 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 22 |
2 files changed, 31 insertions, 16 deletions
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index e0653ddb..048d7596 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -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,25 +305,34 @@ 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(result) => { + let (app, library) = result.unwrap(); + 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"), + Err(err) => log::info!("Couldn't locate Titanfall2 Steam install. {}", 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()); } } |