aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/lib.rs
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-03-20 18:55:50 +0100
committerGitHub <noreply@github.com>2023-03-20 17:55:50 +0000
commit25791906cc8c81368af5718f8ec6ee8b4f428b31 (patch)
tree20b96078bf2185138cdafe20527f048f7f2e2cfe /src-tauri/src/lib.rs
parentc102fdcf8ef00e3c5c46fb9ded37e09b7e92e483 (diff)
downloadFlightCore-25791906cc8c81368af5718f8ec6ee8b4f428b31.tar.gz
FlightCore-25791906cc8c81368af5718f8ec6ee8b4f428b31.zip
fix: Add error handling if default EA App path (#211)
* fix: Add error handling if default EA App path We cannot install to `C:\Program Files\EA Games\Titanfall2` cause Windows™ As such if install fails we check for that path and show according error message * fix: Check only for `Program Files` path instead of the full one As the issue is technically the permissions with `Program Files`, not the EA Games subdirectory... * fix: Format check error
Diffstat (limited to 'src-tauri/src/lib.rs')
-rw-r--r--src-tauri/src/lib.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index ee3c91ed..050b4238 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -239,12 +239,27 @@ pub async fn install_northstar(
..Default::default()
});
- do_install(
+ match do_install(
nmod.versions.get(&nmod.latest).unwrap(),
std::path::Path::new(game_path),
)
.await
- .unwrap();
+ {
+ Ok(_) => (),
+ Err(err) => {
+ if game_path
+ .to_lowercase()
+ .contains(&r#"C:\Program Files\"#.to_lowercase())
+ // default is `C:\Program Files\EA Games\Titanfall2`
+ {
+ return Err(
+ "Cannot install to default EA App install path, please move Titanfall2 to a different install location.".to_string(),
+ );
+ } else {
+ return Err(err.to_string());
+ }
+ }
+ }
Ok(nmod.latest.clone())
}