use anyhow::{anyhow, Result}; use shadow_rs::{is_debug, shadow}; shadow!(build); pub fn get_static_dir>(dir: S) -> Result { let cwd = std::env::current_exe()?.parent().unwrap().to_path_buf(); let base_path = if is_debug() { cwd.join("../../tmp/static") } else { cwd }; let result = base_path.join(dir.as_ref()); if result.exists() { Ok(result) } else { Err(anyhow!("Path {result:?} doesn't exist.")) } }