aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/lib.rs17
-rw-r--r--src-tauri/src/main.rs4
2 files changed, 14 insertions, 7 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 0bb07e90..626f083b 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1,5 +1,13 @@
use anyhow::anyhow;
+#[derive(Debug)]
+pub enum InstallType {
+ STEAM,
+ ORIGIN,
+ EAPLAY,
+ UNKNOWN,
+}
+
/// Check version number of a mod
pub fn check_mod_version_number(path_to_mod_folder: String) -> Result<String, anyhow::Error> {
// println!("{}", format!("{}/mod.json", path_to_mod_folder));
@@ -17,7 +25,7 @@ pub fn check_mod_version_number(path_to_mod_folder: String) -> Result<String, an
}
/// Attempts to find the game install location
-pub fn find_game_install_location() -> Result<String, anyhow::Error> {
+pub fn find_game_install_location() -> Result<(String, InstallType), anyhow::Error> {
// Attempt parsing Steam library directly
match steamlocate::SteamDir::locate() {
Some(mut steamdir) => {
@@ -25,7 +33,7 @@ pub fn find_game_install_location() -> Result<String, anyhow::Error> {
match steamdir.app(&titanfall2_steamid) {
Some(app) => {
// println!("{:#?}", app);
- return Ok(app.path.to_str().unwrap().to_string());
+ return Ok((app.path.to_str().unwrap().to_string(), InstallType::STEAM));
}
None => println!("Couldn't locate Titanfall2"),
}
@@ -39,12 +47,13 @@ pub fn find_game_install_location() -> Result<String, anyhow::Error> {
/// Returns the current Northstar version number as a string
pub fn get_northstar_version_number() -> Result<String, anyhow::Error> {
- let install_location = match find_game_install_location() {
- Ok(path) => path,
+ let (install_location, install_type) = match find_game_install_location() {
+ Ok((path, install_type)) => (path, install_type),
Err(err) => return Err(err),
};
println!("{}", install_location);
+ println!("{:?}", install_type);
// TODO:
// Check if NorthstarLauncher.exe exists and check its version number
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index b90eb8a2..aa6b042e 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -56,7 +56,7 @@ fn main() {
/// Wrapper for `find_game_install_location` as tauri doesn't allow passing `Result<>` types to front-end
fn find_game_install_location_caller() -> String {
match find_game_install_location() {
- Ok(path) => path,
+ Ok((path, install_type)) => path,
Err(err) => {
println!("{}", err);
"".to_string()
@@ -64,7 +64,6 @@ fn find_game_install_location_caller() -> String {
}
}
-
#[tauri::command]
fn hello_world() -> String {
"Hello World!!!".to_string()
@@ -101,4 +100,3 @@ fn get_northstar_version_number_caller() -> String {
}
}
}
-