aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/lib.rs26
-rw-r--r--src-tauri/src/main.rs11
2 files changed, 24 insertions, 13 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 38acf069..b249d519 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -46,17 +46,25 @@ pub fn check_mod_version_number(path_to_mod_folder: String) -> Result<String, an
// for now tho it only checks `ldd --version`
// - salmon
-pub fn linux_checks_librs() -> bool {
- let mut linux_compatible: bool = true; // a variable that starts true and will be set to false if any of the checks arent met
+pub fn linux_checks_librs() -> Result<(), String> {
+ // Perform various checks in terms of Linux compatibility
+ // Return early with error message if a check fails
// check `ldd --version` to see if glibc is up to date for northstar proton
+ let min_required_ldd_version = 2.33;
let lddv = linux::check_glibc_v();
- if lddv < 2.33 { linux_compatible = false };
+ if lddv < min_required_ldd_version {
+ return Err(format!(
+ "GLIBC is not version {} or greater",
+ min_required_ldd_version
+ )
+ .to_string());
+ };
- return linux_compatible;
+ // All checks passed
+ Ok(())
}
-
/// Attempts to find the game install location
pub fn find_game_install_location() -> Result<GameInstall, anyhow::Error> {
// Attempt parsing Steam library directly
@@ -267,7 +275,8 @@ pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> {
// Explicetly fail early certain (currently) unsupported install setups
if host_os != "windows"
|| !(matches!(game_install.install_type, InstallType::STEAM)
- || matches!(game_install.install_type, InstallType::ORIGIN))
+ || matches!(game_install.install_type, InstallType::ORIGIN)
+ || matches!(game_install.install_type, InstallType::UNKNOWN))
{
return Err(format!(
"Not yet implemented for \"{}\" with Titanfall2 installed via \"{:?}\"",
@@ -294,7 +303,8 @@ pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> {
// Only Windows with Steam or Origin are supported at the moment
if host_os == "windows"
&& (matches!(game_install.install_type, InstallType::STEAM)
- || matches!(game_install.install_type, InstallType::ORIGIN))
+ || matches!(game_install.install_type, InstallType::ORIGIN)
+ || matches!(game_install.install_type, InstallType::UNKNOWN))
{
let _output =
std::process::Command::new(format!("{}/NorthstarLauncher.exe", game_install.game_path))
@@ -338,7 +348,7 @@ pub fn convert_release_candidate_number(version_number: String) -> String {
// This simply converts `-rc` to `0`
// Works as intended for RCs < 10, e.g. `v1.9.2-rc1` -> `v1.9.201`
// Doesn't work for larger numbers, e.g. `v1.9.2-rc11` -> `v1.9.2011` (should be `v1.9.211`)
- version_number.replace("-rc", "0")
+ version_number.replace("-rc", "0").replace("00", "")
}
/// Checks if installed FlightCore version is up-to-date
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index a33f836c..411e75c9 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -120,12 +120,13 @@ fn is_debug_mode() -> bool {
#[tauri::command]
/// Returns true if linux compatible
-fn linux_checks() -> bool {
- if get_host_os() == "windows" {
- false
- } else {
- linux_checks_librs()
+fn linux_checks() -> Result<(), String> {
+ // Early return if Windows
+ if get_host_os() == "windows" {
+ return Err("Not available on Windows".to_string());
}
+
+ linux_checks_librs()
}
#[tauri::command]