forge_core_utils/
assets.rs1use directories::ProjectDirs;
2use rust_embed::RustEmbed;
3
4const PROJECT_ROOT: &str = env!("CARGO_MANIFEST_DIR");
5
6pub fn asset_dir() -> std::path::PathBuf {
7 let path = if cfg!(debug_assertions) {
8 std::path::PathBuf::from(PROJECT_ROOT).join("../../dev_assets")
9 } else {
10 ProjectDirs::from("ai", "namastex", "automagik-forge")
11 .expect("OS didn't give us a home directory")
12 .data_dir()
13 .to_path_buf()
14 };
15
16 if !path.exists() {
18 std::fs::create_dir_all(&path).expect("Failed to create asset directory");
19 }
20
21 path
22 }
26
27pub fn config_path() -> std::path::PathBuf {
28 asset_dir().join("config.json")
29}
30
31pub fn profiles_path() -> std::path::PathBuf {
32 asset_dir().join("profiles.json")
33}
34
35#[derive(RustEmbed)]
36#[folder = "assets/sounds"]
37pub struct SoundAssets;
38
39#[derive(RustEmbed)]
40#[folder = "assets/scripts"]
41pub struct ScriptAssets;