veloren: fix assets path search (#447684)

This commit is contained in:
Michele Guerini Rocco
2025-10-02 15:33:25 +00:00
committed by GitHub
2 changed files with 7 additions and 9 deletions
@@ -1,23 +1,19 @@
commit 3048885aa749774b5677ab8df8f1a3eeff125d7a
commit 0a258effd3492d7e4c11b4d175538c619699fbd6
Author: rnhmjoj <rnhmjoj@inventati.org>
Date: Tue Aug 6 08:36:38 2024 +0200
Date: Wed Oct 1 09:43:45 2025 +0200
Fix assets path on NixOS
diff --git a/common/assets/src/lib.rs b/common/assets/src/lib.rs
index 03746dc4..c69d607b 100644
index 13102e8..898b23b 100644
--- a/common/assets/src/lib.rs
+++ b/common/assets/src/lib.rs
@@ -400,6 +400,13 @@ lazy_static! {
@@ -381,6 +381,9 @@ lazy_static! {
}
}
+ // 5. NixOS path
+ if let Some(executable) = std::env::args().nth(0).map(PathBuf::from) {
+ if let Some(package) = executable.ancestors().nth(2) {
+ paths.push(package.join("share/veloren"));
+ }
+ }
+ paths.push("@out@/share/veloren/".into());
+
tracing::trace!("Possible asset locations paths={:?}", paths);
+2
View File
@@ -52,6 +52,8 @@ rustPlatform.buildRustPackage {
println!("cargo:rustc-cfg=nightly");
}
EOF
# Fix assets path
substituteAllInPlace common/assets/src/lib.rs
'';
nativeBuildInputs = [