From 25791906cc8c81368af5718f8ec6ee8b4f428b31 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Mon, 20 Mar 2023 18:55:50 +0100 Subject: fix: Add error handling if default EA App path (#211) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src-tauri/src/lib.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src-tauri/src') 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()) } -- cgit v1.2.3