Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
Windows: canonicalize goes through dunce and the home folder through user_home in the stage, the bundler, export and live play
shinyobjectze388258bffea
diff --git a/Cargo.lock b/Cargo.lockindex b6526ffb..e2842e60 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -14803,6 +14803,7 @@ dependencies = ["bevy","blitz-dom","raea-gpu-device",+ "raea-io-home","raea-runtime-bake","raea-runtime-dom","raea-runtime-js",@@ -15196,6 +15197,7 @@ name = "raea-runtime-export"version = "0.1.0"dependencies = ["bevy",+ "dunce","image","raea-core-facts","raea-core-program",@@ -15294,6 +15296,7 @@ version = "0.1.0"dependencies = ["bevy","cpal 0.15.3",+ "dunce","image","raea-core-program","raea-gpu-device",diff --git a/engine/page/stage/Cargo.toml b/engine/page/stage/Cargo.tomlindex 553e7c70..0f965d99 100644--- a/engine/page/stage/Cargo.toml+++ b/engine/page/stage/Cargo.toml@@ -8,6 +8,7 @@ description = "The live stage in a raea page: a game item's composition played l[dependencies]bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "default_font", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "tonemapping_luts", "ktx2", "zstd_rust", "bevy_picking", "ui_picking", "bevy_ui_widgets", "bevy_input_focus", "jpeg", "bevy_remote", "tga", "qoi", "tiff", "pnm", "ff", "dds", "exr", "hdr", "webp", "gif", "bmp", "ico"] }+raea-io-home = { path = "../../../io/home" }raea-runtime-js = { path = "../../../runtime/js" }raea-runtime-dom = { path = "../../../runtime/dom" }raea-sys-page = { path = "../../../systems/page" }diff --git a/engine/page/stage/src/calls.rs b/engine/page/stage/src/calls.rsindex b08bc748..d565e04d 100644--- a/engine/page/stage/src/calls.rs+++ b/engine/page/stage/src/calls.rs@@ -35,7 +35,7 @@ pub(super) fn calls(mut calls: ResMut<HostCalls>) {return answer.err("the stage needs the shared device (RAEA_SHARED_DEVICE=0 turned it off)");}// a feed item names its game as the app's host does (host/make.ts resolve): ~/ is the home- let src = a.get("src").and_then(Value::as_str).map(|s| match (s.strip_prefix("~/"), std::env::var_os("HOME")) {+ let src = a.get("src").and_then(Value::as_str).map(|s| match (s.strip_prefix("~/"), raea_io_home::user_home()) {(Some(rest), Some(home)) => PathBuf::from(home).join(rest),_ => PathBuf::from(s),});diff --git a/runtime/bundle/src/cache.rs b/runtime/bundle/src/cache.rsindex a666c5a1..62d6141d 100644--- a/runtime/bundle/src/cache.rs+++ b/runtime/bundle/src/cache.rs@@ -32,7 +32,7 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optioeat(&bundle);eat(ext.as_bytes());// this build (its binary's modification time and size): another engine paints other bytes- if let Some(m) = std::env::current_exe().ok().and_then(|e| std::fs::canonicalize(e).ok()).and_then(|e| e.metadata().ok()) {+ if let Some(m) = std::env::current_exe().ok().and_then(|e| dunce::canonicalize(e).ok()).and_then(|e| e.metadata().ok()) {let t = m.modified().ok().and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok()).map(|d| d.as_nanos()).unwrap_or(0);eat(&t.to_le_bytes());eat(&m.len().to_le_bytes());@@ -48,7 +48,7 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optiocontinue;}// a path by where it really is (/var and /private/var are one folder)- match std::fs::canonicalize(a) {+ match dunce::canonicalize(a) {Ok(p) => eat(p.as_os_str().as_encoded_bytes()),Err(_) => eat(a.as_bytes()),}@@ -79,7 +79,7 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optio}}}- let out_abs = std::fs::canonicalize(out).unwrap_or_else(|_| out.to_path_buf());+ let out_abs = dunce::canonicalize(out).unwrap_or_else(|_| out.to_path_buf());walk(tsx.parent()?, 0, &out_abs, &mut files);// exports this cache wrote (an earlier render's OUT.mp4 beside the edit) are outputs, not inputs, unless the// composition plays them: a cut laid from its shots' renders (anything/cut/intro.tsx over intro/renders/*.mp4)@@ -92,14 +92,14 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optio// (a file is one of them only if its name is one of theirs, or it is a link to one: only those are resolved)let names: std::collections::HashSet<&std::ffi::OsStr> = made.iter().filter_map(|m| m.file_name()).collect();let may_be_made = |p: &Path| p.file_name().is_some_and(|n| names.contains(n)) || p.symlink_metadata().is_ok_and(|m| m.file_type().is_symlink());- files.retain(|p| !may_be_made(p) || !made.contains(&std::fs::canonicalize(p).unwrap_or_else(|_| p.clone())) || p.file_stem().is_some_and(|n| text.contains(&*n.to_string_lossy())));+ files.retain(|p| !may_be_made(p) || !made.contains(&dunce::canonicalize(p).unwrap_or_else(|_| p.clone())) || p.file_stem().is_some_and(|n| text.contains(&*n.to_string_lossy())));// absolute media paths the bundle names (an import from outside the edit's folder becomes its path)for q in text.split('"').skip(1).step_by(2) {if q.starts_with('/') && q.len() < 4096 && Path::new(q).extension().and_then(|x| x.to_str()).is_some_and(|x| MEDIA_EXTS.contains(&x.to_ascii_lowercase().as_str())) {files.push(PathBuf::from(q));}}- files.push(std::env::current_exe().ok().and_then(|e| std::fs::canonicalize(e).ok())?);+ files.push(std::env::current_exe().ok().and_then(|e| dunce::canonicalize(e).ok())?);files.sort();files.dedup();// the optimized copies there are, listed once: asking each media file for its own read its first and last MiB anddiff --git a/runtime/bundle/src/fresh.rs b/runtime/bundle/src/fresh.rsindex 59b320a8..b92d3be3 100644--- a/runtime/bundle/src/fresh.rs+++ b/runtime/bundle/src/fresh.rs@@ -102,7 +102,7 @@ pub fn bundle_fresh(tsx: &Path, out_js: &Path, o: &CompOpts, portable: Option<&Premove_work(&work);copy_dir(&dir, &work.join("src"), 0)?;drop_tsconfigs(&work.join("src"), 0);- let motion_src = raea_io_home::home().join("sdk/raea/src").canonicalize().map_err(|e| format!("raea/motion/src: {e}"))?;+ let motion_src = dunce::canonicalize(&raea_io_home::home().join("sdk/raea/src")).map_err(|e| format!("raea/motion/src: {e}"))?;copy_dir(&motion_src, &work.join("motion"), 0)?;let sdks = sdks();for rel in sources(&work.join("motion"))? {diff --git a/runtime/bundle/src/rewrite.rs b/runtime/bundle/src/rewrite.rsindex 5420371c..e18303e1 100644--- a/runtime/bundle/src/rewrite.rs+++ b/runtime/bundle/src/rewrite.rs@@ -68,7 +68,7 @@ pub fn rewrite_into(src: &str, from_dir: &Path, motion_src: &Path, to_motion: &sif !path.exists() {return Err(format!("line {line}: {spec} doesn't exist (imported media resolves beside the edit)"));}- let path = path.canonicalize().map_err(|e| e.to_string())?;+ let path = dunce::canonicalize(&path).map_err(|e| e.to_string())?;match portable {Some(dir) => {let name = path.file_name().unwrap().to_string_lossy().to_string();diff --git a/runtime/export/Cargo.toml b/runtime/export/Cargo.tomlindex 2ece327c..c6b8cd41 100644--- a/runtime/export/Cargo.toml+++ b/runtime/export/Cargo.toml@@ -7,6 +7,7 @@ publish = falsedescription = "A composition rendered to frames and files: React stepped frame by frame, its pages, 3D and sound made into one raea-render program; and its commits baked by frame"[dependencies]+dunce = "1"raea-runtime-view = { path = "../view" }raea-io-assets = { path = "../../io/assets" }raea-runtime-react = { path = "../../runtime/react", default-features = false }diff --git a/runtime/export/src/render.rs b/runtime/export/src/render.rsindex 05554466..f9bdcf33 100644--- a/runtime/export/src/render.rs+++ b/runtime/export/src/render.rs@@ -28,7 +28,7 @@ pub fn render(args: &[String]) -> R<String> {if args.iter().any(|a| a == "--clay") {raea_runtime_scene3d::clay::CLAY.store(true, std::sync::atomic::Ordering::Relaxed);}- let tsx = PathBuf::from(&args[1]).canonicalize().map_err(|e| format!("{}: {e}", args[1]))?;+ let tsx = dunce::canonicalize(&PathBuf::from(&args[1])).map_err(|e| format!("{}: {e}", args[1]))?;let out = PathBuf::from(flag(args, "-o").ok_or("-o OUT.mp4|OUT.png|DIR")?);let dir = tsx.parent().unwrap().to_path_buf();let js = std::env::temp_dir().join(format!("raea-cli-{}.js", std::process::id()));@@ -121,7 +121,7 @@ pub fn render(args: &[String]) -> R<String> {if let Some(d) = c.parent() {prune_cache(d, "mp4", 16);// this export is an output: later keys leave it out of the edit's folder- if let Ok(abs) = std::fs::canonicalize(&out) {+ if let Ok(abs) = dunce::canonicalize(&out) {use std::io::Write as _;if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(d.join("outputs.list")) {let _ = writeln!(f, "{}", abs.display());diff --git a/runtime/export/src/review.rs b/runtime/export/src/review.rsindex 99633b55..1dd51874 100644--- a/runtime/export/src/review.rs+++ b/runtime/export/src/review.rs@@ -10,7 +10,7 @@ use crate::scene::items;use raea_core_review::{TILE_W, VIEWS, boxes_of, cameras, ceiling, inside, parts_box, passed, whole};pub fn review(args: &[String], dir_out: &Path) -> R<String> {- let tsx = PathBuf::from(&args[1]).canonicalize().map_err(|e| format!("{}: {e}", args[1]))?;+ let tsx = dunce::canonicalize(&PathBuf::from(&args[1])).map_err(|e| format!("{}: {e}", args[1]))?;let dir = tsx.parent().unwrap().to_path_buf();let frame = crate::scene::frame_of(args)?;std::fs::create_dir_all(dir_out).map_err(|e| format!("{}: {e}", dir_out.display()))?;diff --git a/runtime/export/src/scene.rs b/runtime/export/src/scene.rsindex d8d65afa..e01d3042 100644--- a/runtime/export/src/scene.rs+++ b/runtime/export/src/scene.rs@@ -41,7 +41,7 @@ pub fn cli(args: &[String]) -> Result<String, String> {if mode != "lint" && mode != "explain" {return Err(usage.into());}- let tsx = std::path::PathBuf::from(edit).canonicalize().map_err(|e| format!("{edit}: {e}"))?;+ let tsx = dunce::canonicalize(&std::path::PathBuf::from(edit)).map_err(|e| format!("{edit}: {e}"))?;let dir = tsx.parent().unwrap().to_path_buf();let frame = frame_of(args)?;let js = std::env::temp_dir().join(format!("raea-scene-{}.js", std::process::id()));@@ -91,7 +91,7 @@ fn frames_of(args: &[String], tsx: &std::path::Path, comp: &str) -> Result<(Vec<fn light(args: &[String]) -> Result<String, String> {let usage = "raea scene light EDIT.tsx [--composition ID[,ID...]] [--frame N|last] [--part NAME] [--json]";let Some(edit) = args.get(2) else { return Err(usage.into()) };- let tsx = std::path::PathBuf::from(edit).canonicalize().map_err(|e| format!("{edit}: {e}"))?;+ let tsx = dunce::canonicalize(&std::path::PathBuf::from(edit)).map_err(|e| format!("{edit}: {e}"))?;let flag = |k: &str| flag(args, k);let comps: Vec<String> = flag("--composition").map(|c| c.split(',').map(str::to_string).collect()).unwrap_or_else(|| vec![String::new()]);let part = flag("--part");diff --git a/runtime/live/Cargo.toml b/runtime/live/Cargo.tomlindex fdf083b2..ac17a03b 100644--- a/runtime/live/Cargo.toml+++ b/runtime/live/Cargo.toml@@ -7,6 +7,7 @@ publish = falsedescription = "A composition stepped live at the display's rate: its page, 3D and sound each frame, with the person's keys and pointer"[dependencies]+dunce = "1"raea-runtime-react = { path = "../../runtime/react", default-features = false }raea-runtime-page = { path = "../page" }raea-runtime-sound = { path = "../sound", default-features = false }diff --git a/runtime/live/src/open.rs b/runtime/live/src/open.rsindex a1940840..02f72d60 100644--- a/runtime/live/src/open.rs+++ b/runtime/live/src/open.rs@@ -17,7 +17,7 @@ impl Live {// the thread that steps and presents live frames, at the frame threads' QoS (as the JS thread)raea_runtime_react::interactive_thread();raea_io_trace::event("open", serde_json::json!({"composition": tsx, "stage": [stage.0, stage.1]}));- let tsx = tsx.canonicalize().map_err(|e| format!("{}: {e}", tsx.display()))?;+ let tsx = dunce::canonicalize(&tsx).map_err(|e| format!("{}: {e}", tsx.display()))?;let dir = tsx.parent().unwrap().to_path_buf();let js = std::env::temp_dir().join(format!("raea-live-{}-{:x}.js", std::process::id(), rand_id()));// the project's words and perception, as a render passes them (captions, regions)@@ -46,7 +46,7 @@ impl Live {raea_runtime_react::interactive_thread();let tmp = std::env::temp_dir().join(format!("raea-live-{}-{:x}.js", std::process::id(), rand_id()));std::fs::copy(js, &tmp).map_err(|e| format!("{}: {e}", js.display()))?;- Self::from_bundle(tmp, dir.canonicalize().map_err(|e| format!("{}: {e}", dir.display()))?, stage, responsive)+ Self::from_bundle(tmp, dunce::canonicalize(&dir).map_err(|e| format!("{}: {e}", dir.display()))?, stage, responsive)}/// The game's master as worked out ahead of time (an exported game carries it): no second React at run time.@@ -88,7 +88,7 @@ impl Live {/// it, then the frames after). The page is the composition's own size.pub fn open_baked(tsx: &Path) -> R<Live> {warm_audio();- let tsx = tsx.canonicalize().map_err(|e| format!("{}: {e}", tsx.display()))?;+ let tsx = dunce::canonicalize(&tsx).map_err(|e| format!("{}: {e}", tsx.display()))?;let dir = tsx.parent().unwrap().to_path_buf();*raea_runtime_react::native::ASSET_DIR.lock().unwrap() = Some(dir.clone());let js = std::env::temp_dir().join(format!("raea-live-{}-{:x}.js", std::process::id(), rand_id()));