redistributable game
This commit is contained in:
parent
28655cc819
commit
d346d68aed
2 changed files with 9 additions and 5 deletions
|
@ -66,3 +66,4 @@ jobs:
|
|||
name: Powercreep
|
||||
path:
|
||||
.ci-destdir/*
|
||||
assets
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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>>>> =
|
||||
Lazy::new(|| Arc::new(Mutex::new(HashSet::new())));
|
||||
|
@ -39,10 +39,13 @@ impl FurnitureAsset {
|
|||
if loaded.contains(&path) {
|
||||
return Some(texture_id(&path));
|
||||
}
|
||||
let bytes = match fs::read(format!(
|
||||
"{}/assets/furniture/{path}",
|
||||
env!("CARGO_MANIFEST_DIR")
|
||||
)) {
|
||||
|
||||
let mut asset_path = PathBuf::from(format!("assets/furniture/{path}"));
|
||||
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,
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => return None,
|
||||
Err(err) => {
|
||||
|
|
Loading…
Reference in a new issue