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
|
name: Powercreep
|
||||||
path:
|
path:
|
||||||
.ci-destdir/*
|
.ci-destdir/*
|
||||||
|
assets
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
Loading…
Reference in a new issue