aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/northstar
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-05-15 22:29:44 +0200
committerGitHub <noreply@github.com>2023-05-15 22:29:44 +0200
commit554de62aaa269c334fda8d88848dffe7270f7eb7 (patch)
tree3b9dc38a7cb3e490df9329fc0173edf57de50637 /src-tauri/src/northstar
parent225e7545e61b4df2c7404114ebba64246017b86e (diff)
downloadFlightCore-554de62aaa269c334fda8d88848dffe7270f7eb7.tar.gz
FlightCore-554de62aaa269c334fda8d88848dffe7270f7eb7.zip
refactor: Remove caller pattern (#356)
* refactor: Remove caller pattern for `launch_northstar` * refactor: Remove caller pattern for `check_is_flightcore_outdated` * refactor: Remove caller pattern for `get_host_os` * refactor: Remove caller pattern for `find_game_install_location` * refactor: Remove caller pattern for `launch_northstar_steam` * fix: Update function call names in frontend * refactor: Remove caller pattern for `get_northstar_version_number` * fix: Address clippy issues * refactor: Rename function to remove `_caller` suffix
Diffstat (limited to 'src-tauri/src/northstar')
-rw-r--r--src-tauri/src/northstar/install.rs1
-rw-r--r--src-tauri/src/northstar/mod.rs13
2 files changed, 9 insertions, 5 deletions
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs
index c01148a1..235c35ff 100644
--- a/src-tauri/src/northstar/install.rs
+++ b/src-tauri/src/northstar/install.rs
@@ -148,6 +148,7 @@ pub async fn install_northstar(
}
/// Attempts to find the game install location
+#[tauri::command]
pub fn find_game_install_location() -> Result<GameInstall, String> {
// Attempt parsing Steam library directly
match steamlocate::SteamDir::locate() {
diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs
index f210faab..7477f6aa 100644
--- a/src-tauri/src/northstar/mod.rs
+++ b/src-tauri/src/northstar/mod.rs
@@ -22,7 +22,8 @@ pub fn check_mod_version_number(path_to_mod_folder: &str) -> Result<String, anyh
}
/// Returns the current Northstar version number as a string
-pub fn get_northstar_version_number(game_path: &str) -> Result<String, anyhow::Error> {
+#[tauri::command]
+pub fn get_northstar_version_number(game_path: &str) -> Result<String, String> {
log::info!("{}", game_path);
// TODO:
@@ -33,7 +34,7 @@ pub fn get_northstar_version_number(game_path: &str) -> Result<String, anyhow::E
CORE_MODS[0]
)) {
Ok(version_number) => version_number,
- Err(err) => return Err(err),
+ Err(err) => return Err(err.to_string()),
};
for core_mod in CORE_MODS {
@@ -41,11 +42,11 @@ pub fn get_northstar_version_number(game_path: &str) -> Result<String, anyhow::E
"{game_path}/{profile_folder}/mods/{core_mod}",
)) {
Ok(version_number) => version_number,
- Err(err) => return Err(err),
+ Err(err) => return Err(err.to_string()),
};
if current_version_number != initial_version_number {
// We have a version number mismatch
- return Err(anyhow!("Found version number mismatch"));
+ return Err("Found version number mismatch".to_string());
}
}
log::info!("All mods same version");
@@ -53,8 +54,10 @@ pub fn get_northstar_version_number(game_path: &str) -> Result<String, anyhow::E
Ok(initial_version_number)
}
+/// Launches Northstar
+#[tauri::command]
pub fn launch_northstar(
- game_install: &GameInstall,
+ game_install: GameInstall,
bypass_checks: Option<bool>,
) -> Result<String, String> {
dbg!(game_install.clone());