aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2024-04-15 16:17:54 +0200
committerGitHub <noreply@github.com>2024-04-15 16:17:54 +0200
commite67a0c4cd69c9de1d8effdd077eddfffa1125a70 (patch)
treeaf19dcae88ede886f4783c7f2d30991c66ea3dc0
parent1e2c5db222bd02c9cc9b2b7455123b670b45e8aa (diff)
downloadFlightCore-e67a0c4cd69c9de1d8effdd077eddfffa1125a70.tar.gz
FlightCore-e67a0c4cd69c9de1d8effdd077eddfffa1125a70.zip
chore: bump steamlocate from 1.2 to 2.0.0-beta.2 (#891)
Gets rid of `steamy_vdf` and other out of date dependencies
-rw-r--r--src-tauri/Cargo.lock75
-rw-r--r--src-tauri/Cargo.toml2
-rw-r--r--src-tauri/src/northstar/install.rs25
-rw-r--r--src-tauri/src/northstar/mod.rs22
-rw-r--r--src-tauri/src/platform_specific/linux.rs62
5 files changed, 116 insertions, 70 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 9277f4af..6f4bc735 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -689,6 +689,21 @@ dependencies = [
]
[[package]]
+name = "crc"
+version = "3.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+
+[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2230,9 +2245,9 @@ dependencies = [
[[package]]
name = "keyvalues-parser"
-version = "0.1.0"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d990301996c856ea07a84bc291e76f1273db52683663efc05c8d355976897e5"
+checksum = "7e4c8354918309196302015ac9cae43362f1a13d0d5c5539a33b4c2fd2cd6d25"
dependencies = [
"pest",
"pest_derive",
@@ -2241,14 +2256,11 @@ dependencies = [
[[package]]
name = "keyvalues-serde"
-version = "0.1.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da419ac133bb3ddf0dbf9c12fcc0ce01d994fcb65f6f1713faf15cc689320b5f"
+checksum = "0447866c47c00f8bd1949618e8f63017cf93e985b4684dc28d784527e2882390"
dependencies = [
"keyvalues-parser",
- "once_cell",
- "paste",
- "regex",
"serde",
"thiserror",
]
@@ -2569,12 +2581,6 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nom"
-version = "1.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
-
-[[package]]
-name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
@@ -2954,12 +2960,6 @@ dependencies = [
]
[[package]]
-name = "paste"
-version = "1.0.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
-
-[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4355,25 +4355,16 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "steamlocate"
-version = "1.2.1"
+version = "2.0.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ec01c74611d14a808cb212d17c6e03f0e30736a15ed1d5736f8a53154cea3ae"
+checksum = "c3b6a4810c4e7fecb0123a9a8ba99b335c17d92e636c265ef99108ee4734c812"
dependencies = [
+ "crc",
"dirs",
"keyvalues-parser",
"keyvalues-serde",
"serde",
- "steamy-vdf",
- "winreg 0.11.0",
-]
-
-[[package]]
-name = "steamy-vdf"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "533127ad49314bfe71c3d3fd36b3ebac3d24f40618092e70e1cfe8362c7fac79"
-dependencies = [
- "nom 1.2.4",
+ "winreg 0.51.0",
]
[[package]]
@@ -4864,18 +4855,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thiserror"
-version = "1.0.44"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
+checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.44"
+version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
+checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",
@@ -5175,7 +5166,7 @@ dependencies = [
"bytecount",
"fnv",
"lazy_static",
- "nom 7.1.3",
+ "nom",
"once_cell",
"petgraph",
]
@@ -6105,6 +6096,16 @@ dependencies = [
[[package]]
name = "winreg"
+version = "0.51.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc"
+dependencies = [
+ "cfg-if",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "winreg"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index ba401afd..faf9069f 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -29,7 +29,7 @@ tokio = { version = "1", features = ["full"] }
sentry = "0.32"
sentry-log = "0.32"
# Find steam games
-steamlocate = "1.2"
+steamlocate = "2.0.0-beta.2"
# Error messages
anyhow = "1.0"
# libthermite for Northstar/mod install handling
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs
index e0653ddb..048d7596 100644
--- a/src-tauri/src/northstar/install.rs
+++ b/src-tauri/src/northstar/install.rs
@@ -293,7 +293,7 @@ pub async fn install_northstar(
pub fn find_game_install_location() -> Result<GameInstall, String> {
// Attempt parsing Steam library directly
match steamlocate::SteamDir::locate() {
- Some(mut steamdir) => {
+ Ok(steamdir) => {
#[cfg(target_os = "linux")]
{
let snap_dir = match std::env::var("SNAP_USER_DATA") {
@@ -305,25 +305,34 @@ pub fn find_game_install_location() -> Result<GameInstall, String> {
.join("snap"),
};
- if steamdir.path.starts_with(snap_dir) {
+ if steamdir.path().starts_with(snap_dir) {
log::warn!("Found Steam installed via Snap, you may encounter issues");
}
}
- match steamdir.app(&thermite::TITANFALL2_STEAM_ID) {
- Some(app) => {
- // println!("{:#?}", app);
+ match steamdir.find_app(thermite::TITANFALL2_STEAM_ID) {
+ Ok(result) => {
+ let (app, library) = result.unwrap();
+ let app_path = library
+ .path()
+ .join("steamapps")
+ .join("common")
+ .join(app.install_dir)
+ .into_os_string()
+ .into_string()
+ .unwrap();
+
let game_install = GameInstall {
- game_path: app.path.to_str().unwrap().to_string(),
+ game_path: app_path,
profile: "R2Northstar".to_string(),
install_type: InstallType::STEAM,
};
return Ok(game_install);
}
- None => log::info!("Couldn't locate Titanfall2 Steam install"),
+ Err(err) => log::info!("Couldn't locate Titanfall2 Steam install. {}", err),
}
}
- None => log::info!("Couldn't locate Steam on this computer!"),
+ Err(err) => log::info!("Couldn't locate Steam on this computer! {}", err),
}
// (On Windows only) try parsing Windows registry for Origin install path
diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs
index 0b37c3f6..4b16f701 100644
--- a/src-tauri/src/northstar/mod.rs
+++ b/src-tauri/src/northstar/mod.rs
@@ -235,19 +235,25 @@ pub fn launch_northstar_steam(game_install: GameInstall) -> Result<String, Strin
}
match steamlocate::SteamDir::locate() {
- Some(mut steamdir) => {
+ Ok(steamdir) => {
if get_host_os() != "windows" {
- match steamdir.compat_tool(&thermite::TITANFALL2_STEAM_ID) {
- Some(_) => {}
- None => {
- return Err(
- "Titanfall2 was not configured to use a compatibility tool".to_string()
- );
+ match steamdir.compat_tool_mapping() {
+ Ok(map) => match map.get(&thermite::TITANFALL2_STEAM_ID) {
+ Some(_) => {}
+ None => {
+ return Err(
+ "Titanfall2 was not configured to use a compatibility tool"
+ .to_string(),
+ );
+ }
+ },
+ Err(_) => {
+ return Err("Could not get compatibility tool mapping".to_string());
}
}
}
}
- None => {
+ Err(_) => {
return Err("Couldn't access Titanfall2 directory".to_string());
}
}
diff --git a/src-tauri/src/platform_specific/linux.rs b/src-tauri/src/platform_specific/linux.rs
index 4a901cb8..fcac5b67 100644
--- a/src-tauri/src/platform_specific/linux.rs
+++ b/src-tauri/src/platform_specific/linux.rs
@@ -1,49 +1,79 @@
// Linux specific code
-fn get_proton_dir() -> Option<String> {
- let steam_dir = steamlocate::SteamDir::locate()?;
- let compat_dir = format!("{}/compatibilitytools.d", steam_dir.path.display());
-
- Some(compat_dir)
+fn get_proton_dir() -> Result<String, String> {
+ let steam_dir = match steamlocate::SteamDir::locate() {
+ Ok(result) => result,
+ Err(_) => return Err("Unable to find Steam directory".to_string()),
+ };
+ let compat_dir = format!("{}/compatibilitytools.d", steam_dir.path().display());
+
+ Ok(compat_dir)
}
/// Downloads and installs NS proton
/// Assumes Steam install
-pub fn install_ns_proton() -> Result<(), thermite::prelude::ThermiteError> {
+pub fn install_ns_proton() -> Result<(), String> {
// Get latest NorthstarProton release
- let latest = thermite::core::latest_release()?;
+ let latest = match thermite::core::latest_release() {
+ Ok(result) => result,
+ Err(_) => return Err("Failed to fetch latest NorthstarProton release".to_string()),
+ };
let temp_dir = std::env::temp_dir();
let path = format!("{}/nsproton-{}.tar.gz", temp_dir.display(), latest);
- let archive = std::fs::File::create(path.clone())?;
+ let archive = match std::fs::File::create(path.clone()) {
+ Ok(result) => result,
+ Err(_) => return Err("Failed to allocate NorthstarProton archive on disk".to_string()),
+ };
// Download the latest Proton release
log::info!("Downloading NorthstarProton to {}", path);
- thermite::core::download_ns_proton(latest, archive)?;
+ match thermite::core::download_ns_proton(latest, archive) {
+ Ok(_) => {}
+ Err(_) => return Err("Failed to download NorthstarProton".to_string()),
+ }
+
log::info!("Finished Download");
- let compat_dir = get_proton_dir().unwrap();
- std::fs::create_dir_all(compat_dir.clone())?;
+ let compat_dir = get_proton_dir()?;
- let finished = std::fs::File::open(path.clone())?;
+ match std::fs::create_dir_all(compat_dir.clone()) {
+ Ok(_) => {}
+ Err(_) => return Err("Failed to create compatibilitytools directory".to_string()),
+ }
+
+ let finished = match std::fs::File::open(path.clone()) {
+ Ok(result) => result,
+ Err(_) => return Err("Failed to open NorthstarProton archive".to_string()),
+ };
// Extract to Proton dir
log::info!("Installing NorthstarProton to {}", compat_dir);
- thermite::core::install_ns_proton(&finished, compat_dir)?;
+ match thermite::core::install_ns_proton(&finished, compat_dir) {
+ Ok(_) => {}
+ Err(_) => return Err("Failed to create install NorthstarProton".to_string()),
+ }
log::info!("Finished Installation");
drop(finished);
- std::fs::remove_file(path)?;
+ // We installed NSProton, lets ignore this if it fails
+ let _ = std::fs::remove_file(path);
Ok(())
}
/// Remove NS Proton
pub fn uninstall_ns_proton() -> Result<(), String> {
- let compat_dir = get_proton_dir().unwrap();
+ let compat_dir = get_proton_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();
+ match e {
+ Ok(path) => match std::fs::remove_dir_all(path.clone()) {
+ Ok(_) => {}
+ Err(_) => return Err(format!("Failed to remove {}", path.display())),
+ },
+ Err(e) => return Err(format!("Found unprocessable entry {}", e)),
+ }
}
Ok(())