aboutsummaryrefslogtreecommitdiff
path: root/libs/nak/src/runtime_wrap.rs
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-04-01 15:31:43 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-04-01 15:31:43 -0500
commit45aefb63e84fd3c75be7b24264885a53f3fb44b8 (patch)
treeb702079f16be91eb7e170d608c3de9879976c10e /libs/nak/src/runtime_wrap.rs
parente92d166ce97a9335f0e16526b40dc5dc456c361c (diff)
Fix SLR download failures and CMake rebuild detection
Replace SHA256SUMS verification with Content-Length check for SLR downloads. Valve's CDN frequently serves stale SHA256SUMS that don't match the current archive, causing persistent checksum mismatches. Fix CMake DEPENDS for nak_ffi to glob all .rs sources instead of hardcoding a few files — previously changes to slr.rs (and most other Rust files) were silently ignored by ninja. Also wrap prefix init and runtime commands through SLR pressure-vessel container, and expose Proton install directories to the container. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'libs/nak/src/runtime_wrap.rs')
-rw-r--r--libs/nak/src/runtime_wrap.rs47
1 files changed, 43 insertions, 4 deletions
diff --git a/libs/nak/src/runtime_wrap.rs b/libs/nak/src/runtime_wrap.rs
index 37980d3..943a329 100644
--- a/libs/nak/src/runtime_wrap.rs
+++ b/libs/nak/src/runtime_wrap.rs
@@ -2,15 +2,54 @@ use std::ffi::OsStr;
use std::process::Command;
/// Build a command to run `exe` with the given environment variables.
+///
+/// If SLR (Steam Linux Runtime) is installed, the command is wrapped inside
+/// the pressure-vessel container via the SLR `run` script. Environment
+/// variables are set on the process and inherited by pressure-vessel into the
+/// container (matching how game launches work via QProcess). This ensures
+/// Wine/Proton commands use the container's libraries instead of potentially
+/// broken host libraries.
pub fn build_command<S: AsRef<OsStr>>(
exe: impl AsRef<OsStr>,
envs: &[(&str, S)],
) -> Command {
- let mut cmd = Command::new(exe);
- for (key, value) in envs {
- cmd.env(key, value.as_ref());
+ if let Some(slr_script) = crate::slr::get_slr_run_script() {
+ let mut cmd = Command::new(&slr_script);
+ // Set env vars on the process — pressure-vessel inherits them
+ for (key, value) in envs {
+ cmd.env(key, value.as_ref());
+ }
+ // Expose the executable's parent directory to the container —
+ // needed for system-installed Protons (e.g. /usr/share/steam/...)
+ // whose files may not be visible inside the container by default.
+ if let Some(parent) = std::path::Path::new(exe.as_ref()).parent() {
+ if parent.exists() {
+ let mut flag = std::ffi::OsString::from("--filesystem=");
+ flag.push(parent.as_os_str());
+ cmd.arg(flag);
+ }
+ }
+ // Also expose WINEPREFIX if set in env vars
+ for (key, value) in envs {
+ if *key == "WINEPREFIX" || *key == "STEAM_COMPAT_DATA_PATH" {
+ let path = std::path::Path::new(value.as_ref());
+ if path.exists() || path.parent().map_or(false, |p| p.exists()) {
+ let mut flag = std::ffi::OsString::from("--filesystem=");
+ flag.push(value.as_ref());
+ cmd.arg(flag);
+ }
+ }
+ }
+ cmd.arg("--");
+ cmd.arg(exe);
+ cmd
+ } else {
+ let mut cmd = Command::new(exe);
+ for (key, value) in envs {
+ cmd.env(key, value.as_ref());
+ }
+ cmd
}
- cmd
}
/// Build a command with no extra environment variables.