aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/platform_specific
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2024-04-14 02:23:11 +0200
committerGitHub <noreply@github.com>2024-04-14 02:23:11 +0200
commit24ca626e2bd0a7b35d4e0421ec3722fa710c62c4 (patch)
tree1eac36231854f7d8f4d3df2caf9da5a3e812d3ec /src-tauri/src/platform_specific
parent505d01b280b21447af9c562bb4a3d9b69d3cf461 (diff)
downloadFlightCore-24ca626e2bd0a7b35d4e0421ec3722fa710c62c4.tar.gz
FlightCore-24ca626e2bd0a7b35d4e0421ec3722fa710c62c4.zip
fix: Change Proton detection for new GE base (#892)
Update Proton detection logic for newer versions of NorthstarProton which are based on newer ProtonGE versions.
Diffstat (limited to 'src-tauri/src/platform_specific')
-rw-r--r--src-tauri/src/platform_specific/linux.rs28
1 files changed, 10 insertions, 18 deletions
diff --git a/src-tauri/src/platform_specific/linux.rs b/src-tauri/src/platform_specific/linux.rs
index 706a4d22..756fced1 100644
--- a/src-tauri/src/platform_specific/linux.rs
+++ b/src-tauri/src/platform_specific/linux.rs
@@ -26,7 +26,7 @@ pub fn linux_checks_librs() -> Result<(), String> {
fn get_proton_dir() -> Option<String> {
let steam_dir = steamlocate::SteamDir::locate()?;
- let compat_dir = format!("{}/compatibilitytools.d/", steam_dir.path.display());
+ let compat_dir = format!("{}/compatibilitytools.d", steam_dir.path.display());
Some(compat_dir)
}
@@ -65,7 +65,7 @@ pub fn install_ns_proton() -> Result<(), thermite::prelude::ThermiteError> {
/// Remove NS Proton
pub fn uninstall_ns_proton() -> Result<(), String> {
let compat_dir = get_proton_dir().unwrap();
- let pattern = format!("{}/NorthstarProton-*", compat_dir);
+ let pattern = format!("{}/NorthstarProton*", compat_dir);
for e in glob::glob(&pattern).expect("Failed to read glob pattern") {
std::fs::remove_dir_all(e.unwrap()).unwrap();
}
@@ -76,27 +76,19 @@ pub fn uninstall_ns_proton() -> Result<(), String> {
/// Get the latest installed NS Proton version
pub fn get_local_ns_proton_version() -> Result<String, String> {
let compat_dir = get_proton_dir().unwrap();
- let ns_prefix = "NorthstarProton-";
- let pattern = format!("{}/{}*/version", compat_dir, ns_prefix);
+ let pattern = format!("{}/NorthstarProton*/version", compat_dir);
- let mut version: String = "".to_string();
-
- for e in glob::glob(&pattern).expect("Failed to read glob pattern") {
+ if let Some(e) = glob::glob(&pattern)
+ .expect("Failed to read glob pattern")
+ .next()
+ {
let version_content = std::fs::read_to_string(e.unwrap()).unwrap();
- let version_string = version_content.split(' ').nth(1).unwrap();
-
- if version_string.starts_with(ns_prefix) {
- version = version_string[ns_prefix.len()..version_string.len() - 1]
- .to_string()
- .clone();
- }
- }
+ let version = version_content.split(' ').nth(1).unwrap().to_string();
- if version.is_empty() {
- return Err("Northstar Proton is not installed".to_string());
+ return Ok(version);
}
- Ok(version)
+ Err("Northstar Proton is not installed".to_string())
}
pub fn check_glibc_v() -> f32 {