aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/lib.rs
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-01 19:26:39 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-01 19:26:39 +0200
commit312cddf2c2b6fd715e3133095c4562c78807b236 (patch)
treefb84f89970051ce13149e3aa9dc2ec08d5d49f3c /src-tauri/src/lib.rs
parent340b96e5878b892d81dbc7e5cdbc0215ce78b4d9 (diff)
downloadFlightCore-312cddf2c2b6fd715e3133095c4562c78807b236.tar.gz
FlightCore-312cddf2c2b6fd715e3133095c4562c78807b236.zip
Handle gamepath check if manually selected
as well as Northstar existence and up-to-date check
Diffstat (limited to 'src-tauri/src/lib.rs')
-rw-r--r--src-tauri/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 626f083b..58a04c5e 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -88,3 +88,16 @@ pub fn get_northstar_version_number() -> Result<String, anyhow::Error> {
Ok(initial_version_number)
}
+
+/// Checks whether the provided path is a valid Titanfall2 gamepath by checking against a certain set of criteria
+pub fn check_is_valid_game_path(game_install_path: &str) -> Result<(), anyhow::Error> {
+ let is_correct_game_path =
+ std::path::Path::new(&format!("{}/Titanfall2.exe", game_install_path)).exists();
+ println!("Titanfall2.exe exists in path? {}", is_correct_game_path);
+
+ // Exit early if wrong game path
+ if !is_correct_game_path {
+ return Err(anyhow!("Incorrect game path \"{}\"", game_install_path)); // Return error cause wrong game path
+ }
+ Ok(())
+}