diff options
author | Jan <sentrycraft123@gmail.com> | 2023-07-18 13:16:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 13:16:41 +0200 |
commit | 9e6806bbc3b9f6ee81ae172cd9348fe91868b114 (patch) | |
tree | 6d67b45180a5c0e5f024f67cb7372cbac1d688ae | |
parent | 7b188d5fa95cb12a8e00051ecfaab14cbe1ff1e8 (diff) | |
download | FlightCore-9e6806bbc3b9f6ee81ae172cd9348fe91868b114.tar.gz FlightCore-9e6806bbc3b9f6ee81ae172cd9348fe91868b114.zip |
feat: Add warning for Snap installations (#399)
Prints a warning to console if snap installation of Steam is detected.
-rw-r--r-- | src-tauri/Cargo.lock | 1 | ||||
-rw-r--r-- | src-tauri/Cargo.toml | 1 | ||||
-rw-r--r-- | src-tauri/src/northstar/install.rs | 16 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 0756d3b5..14e8c564 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -82,6 +82,7 @@ dependencies = [ "async-recursion", "chrono", "const_format", + "dirs", "json5", "libthermite", "log", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c11e658d..908bc99e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -62,6 +62,7 @@ zip-extract = "0.1.2" # open urls open = "3.2.0" semver = "1.0" +dirs = "5" [target.'cfg(windows)'.dependencies] # Windows API stuff diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index 875458dd..c77fd538 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -168,6 +168,22 @@ pub fn find_game_install_location() -> Result<GameInstall, String> { // Attempt parsing Steam library directly match steamlocate::SteamDir::locate() { Some(mut steamdir) => { + #[cfg(target_os = "linux")] + { + let snap_dir = match std::env::var("SNAP_USER_DATA") { + Ok(snap_dir) => std::path::PathBuf::from(snap_dir), + Err(_) => match dirs::home_dir() { + Some(path) => path, + None => std::path::PathBuf::new(), + } + .join("snap"), + }; + + 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) => { |