mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
resolve_src read /media/fonts/x.png as a file at the root, so an R3F ShaderMaterial or TSL node material whose texture
came from new THREE.TextureLoader().load(staticFile("fonts/x.png")) found no such file, and its render was refused
(a material's map, drei's Environment files and every other source already went through media_path). /media/ paths
now go through raea-core-scene media_path in resolve_src itself, with a test.
15 lines
791 B
Rust
15 lines
791 B
Rust
//! A row's source as a file: a staticFile path (/media/x) is found in the media folders, as a material's map and every
|
|
//! other media src is, not read as a file at the root (a three.js shader's texture once was: "/media/fonts/x.png").
|
|
|
|
use raea_sys_frame::resolve_src;
|
|
|
|
#[test]
|
|
fn a_static_file_is_found_in_media() {
|
|
let dir = std::env::temp_dir().join(format!("raea-resolve-src-{}", std::process::id()));
|
|
std::fs::create_dir_all(dir.join("media/fonts")).unwrap();
|
|
std::fs::write(dir.join("media/fonts/x.png"), "").unwrap();
|
|
assert_eq!(resolve_src(&[], "/media/fonts/x.png", &dir).unwrap(), dir.join("media/fonts/x.png"));
|
|
// a relative path is still the edit's own
|
|
assert_eq!(resolve_src(&[], "media/fonts/x.png", &dir).unwrap(), dir.join("media/fonts/x.png"));
|
|
}
|