diff options
author | Jan <sentrycraft123@gmail.com> | 2023-07-18 14:26:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 14:26:20 +0200 |
commit | 9dccdb0b0335f82aa9f2e63642f16ff0f2699528 (patch) | |
tree | 22c4651dd5cafc4375e4cd2a76dccf5e389388c5 /src-tauri/src/main.rs | |
parent | dfa5af1746546d388a85081fae499c28521a20ea (diff) | |
download | FlightCore-9dccdb0b0335f82aa9f2e63642f16ff0f2699528.tar.gz FlightCore-9dccdb0b0335f82aa9f2e63642f16ff0f2699528.zip |
feat: Add basic Proton management (#383)
Adds logic to install, remove, and check existing install of NorthstarProton.
Diffstat (limited to 'src-tauri/src/main.rs')
-rw-r--r-- | src-tauri/src/main.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a584eea9..a295f322 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -144,6 +144,9 @@ fn main() { mod_management::delete_northstar_mod, util::get_server_player_count, mod_management::delete_thunderstore_mod, + install_northstar_proton_wrapper, + uninstall_northstar_proton_wrapper, + get_local_northstar_proton_wrapper_version, open_repair_window, thunderstore::query_thunderstore_packages_api, github::get_list_of_tags, @@ -525,3 +528,32 @@ pub fn check_is_valid_game_path(game_install_path: &str) -> Result<(), String> { fn get_host_os() -> String { env::consts::OS.to_string() } + +/// On Linux attempts to install NorthstarProton +/// On Windows simply returns an error message +#[tauri::command] +async fn install_northstar_proton_wrapper() -> Result<(), String> { + #[cfg(target_os = "linux")] + return linux::install_ns_proton().map_err(|err| err.to_string()); + + #[cfg(target_os = "windows")] + Err("Not supported on Windows".to_string()) +} + +#[tauri::command] +async fn uninstall_northstar_proton_wrapper() -> Result<(), String> { + #[cfg(target_os = "linux")] + return linux::uninstall_ns_proton(); + + #[cfg(target_os = "windows")] + Err("Not supported on Windows".to_string()) +} + +#[tauri::command] +async fn get_local_northstar_proton_wrapper_version() -> Result<String, String> { + #[cfg(target_os = "linux")] + return linux::get_local_ns_proton_version(); + + #[cfg(target_os = "windows")] + Err("Not supported on Windows".to_string()) +} |