redistributable game
Some checks failed
Rust / rustfmt (push) Successful in 19s
Rust / clippy (push) Failing after 1m29s
Rust / build (push) Successful in 2m8s

This commit is contained in:
Dominic 2024-07-07 17:44:17 +02:00
parent 28655cc819
commit d346d68aed
Signed by: msrd0
GPG key ID: AAF7C8430CA3345D
2 changed files with 9 additions and 5 deletions

View file

@ -66,3 +66,4 @@ jobs:
name: Powercreep name: Powercreep
path: path:
.ci-destdir/* .ci-destdir/*
assets

View file

@ -1,5 +1,5 @@
use comfy::{error, texture_id, EngineContext, HashSet, Lazy, Mutex, TextureHandle}; use comfy::{error, texture_id, EngineContext, HashSet, Lazy, Mutex, TextureHandle};
use std::{fmt::Debug, fs, io, sync::Arc}; use std::{fmt::Debug, fs, io, path::PathBuf, sync::Arc};
static ASSETS_LOADED: Lazy<Arc<Mutex<HashSet<String>>>> = static ASSETS_LOADED: Lazy<Arc<Mutex<HashSet<String>>>> =
Lazy::new(|| Arc::new(Mutex::new(HashSet::new()))); Lazy::new(|| Arc::new(Mutex::new(HashSet::new())));
@ -39,10 +39,13 @@ impl FurnitureAsset {
if loaded.contains(&path) { if loaded.contains(&path) {
return Some(texture_id(&path)); return Some(texture_id(&path));
} }
let bytes = match fs::read(format!(
"{}/assets/furniture/{path}", let mut asset_path = PathBuf::from(format!("assets/furniture/{path}"));
env!("CARGO_MANIFEST_DIR") if !asset_path.exists() {
)) { asset_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(asset_path);
}
let bytes = match fs::read(asset_path) {
Ok(bytes) => bytes, Ok(bytes) => bytes,
Err(err) if err.kind() == io::ErrorKind::NotFound => return None, Err(err) if err.kind() == io::ErrorKind::NotFound => return None,
Err(err) => { Err(err) => {