diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-23 14:50:31 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-23 16:18:34 -0500 |
| commit | bb670049840e64e96b9bf0bf72897d6f3a928194 (patch) | |
| tree | 93adb7011a450b693e8be0c23707ad9813842a63 /audio/src/data.rs | |
| parent | audio: some changes (diff) | |
| download | DungeonCrawl-bb670049840e64e96b9bf0bf72897d6f3a928194.tar.gz DungeonCrawl-bb670049840e64e96b9bf0bf72897d6f3a928194.tar.bz2 DungeonCrawl-bb670049840e64e96b9bf0bf72897d6f3a928194.zip | |
audio: refactor everything
Diffstat (limited to 'audio/src/data.rs')
| -rw-r--r-- | audio/src/data.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/audio/src/data.rs b/audio/src/data.rs index e63254d..9ed8019 100644 --- a/audio/src/data.rs +++ b/audio/src/data.rs @@ -3,13 +3,17 @@ use std::fs; macro_rules! load_asm { ($path:tt) => {{ - if cfg!(any(feature = "static", target_arch = "wasm32")) { + let res = if cfg!(any(feature = "static", target_arch = "wasm32")) { let src = include_str!(concat!("../../", $path)); - Program::parse(src, true)? + Program::parse(src, true) } else { let src = fs::read_to_string($path)?; - Program::parse(&src, true)? - } + Program::parse(&src, true) + }; + res.map_err(|mut err| { + err.file = Some(String::from($path)); + err + })? }}; ($first:tt, $($arg:tt),*) => { load_asm!($first)$(.merge(load_asm!($arg)))* |