mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
canonicalize() through std gives \\?\C:\... on Windows: a path Git for Windows can neither read nor lock, Rolldown can't resolve, and which shares no root with the C:\... git and everything else print. It broke a new workspace's git config (fixed in apps/workspace earlier today). Here the calls in the apps (CapCut, check, direction, engines, fingerprint, game, interchange, judge, solid, sound, targets, tools), the bundler, the CLI, the modules loader, the native shim's realpath, the page's motion, io (assets, gen, home, shell), runtime/bundle/lib, js, track and world, the systems (fingerprint-use, footage, index, ml, page-net), the bridge bench's examples and the sdk/ui test tools use dunce::canonicalize, which gives C:\... wherever a path can be said so and is std's own call on the Mac and Linux.
Reads of the home folder took HOME alone, which Windows doesn't set for an app opened from the Start menu or Explorer, so the taste file, the settings file, the inbox, the npm store, the caches (sounds, splats, goo, ingest, speech, Core ML, the portable perceive models), the node shim's os.homedir() and CapCut's drafts were looked for under whatever folder raea ran in. raea_io_home::user_home() reads HOME, then USERPROFILE (Git for Windows' order; an empty one counts as unset), and models(), caches(), logs(), env_path() and offline() use it, as do the places that had their own fallback.
The caches that had their own copy of "this variable, else this folder under home" (splats, goo, ingest, the npm store, Core ML's models) now call raea_io_home::env_path and models(), and raea_io_home::real canonicalizes a path or keeps it as given, so tools/dupes.max comes down to 289 exact and 58 near. tools/skills.sh reads a variable from env_path("RAEA_...", ".raea/...") as it did from env::var, so files.md keeps RAEA_NPM_HOME on ~/.raea/npm (every generated reference is unchanged).
Five crates hold other sessions' uncommitted edits (engine/page/stage, engine/render, runtime/bundle, runtime/export, runtime/live): their few calls, and tools/windows-paths.sh, the check that keeps both at zero, land once those are committed.
Checked: cargo check --all-targets of every crate changed, and of sdk/ui/conformance and sdk/ui/parity. On a Windows 11 PC and on macOS the unit tests of raea-io-home (user_home's order and an empty HOME, now in caches_logs_and_the_home_folder_follow_the_platform), raea-app-check, raea-app-workspace, raea-app-registry and raea-core-facts pass (5, 27, 10, 7, 17).
76 lines
3.6 KiB
Rust
76 lines
3.6 KiB
Rust
//! docs/sdk.feature S2d's bench (bench/bridge/run.sh --pixels): /ecs's typed query on the host's World (@raea/app's
|
|
//! HostWorld) in a plain App. The component is registered for reflection only, never shared (no share_component); the
|
|
//! composition (bench/bridge/hostquery.tsx) queries it by name outside React's render, sets it to 100 through a write
|
|
//! binding once, and shows what the query answers; a system counts up from 100. It passes when the write reached the
|
|
//! World and the text shows the World's values as they change, in order, never ahead of it.
|
|
//!
|
|
//! raea bundle bench/bridge/hostquery.tsx --composition-bundle -o hostquery.js
|
|
//! cargo run --release -p raea-bridge-bench --example host_query -- hostquery.js
|
|
use bevy::camera::RenderTarget;
|
|
use bevy::prelude::*;
|
|
use bevy::render::render_resource::TextureFormat;
|
|
use bevy::window::ExitCondition;
|
|
use raea_runtime_react::scene::ScenePlugin;
|
|
use raea_runtime_react::{ReactPlugin, ReactText};
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Component, Reflect, Default, Debug)]
|
|
#[reflect(Component)]
|
|
#[type_path = "bench"]
|
|
struct Hq {
|
|
n: u32,
|
|
}
|
|
|
|
/// Counting up, once React has set it.
|
|
fn count(mut q: Query<&mut Hq>) {
|
|
for mut h in &mut q {
|
|
if h.n >= 100 {
|
|
h.n += 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let Some(js) = std::env::args().nth(1) else {
|
|
eprintln!("usage: host_query HOSTQUERY.js");
|
|
std::process::exit(2);
|
|
};
|
|
let js = dunce::canonicalize(&PathBuf::from(js)).expect("the bundle");
|
|
let mut app = App::new();
|
|
app.add_plugins(
|
|
DefaultPlugins
|
|
.set(WindowPlugin { primary_window: None, exit_condition: ExitCondition::DontExit, close_when_requested: false, ..default() })
|
|
.disable::<bevy::render::pipelined_rendering::PipelinedRenderingPlugin>(),
|
|
);
|
|
let image = app.world_mut().resource_mut::<Assets<Image>>().add(Image::new_target_texture(320, 180, TextureFormat::Rgba8UnormSrgb, None));
|
|
app.add_plugins((ReactPlugin::new(js.clone()), ScenePlugin { target: RenderTarget::Image(image.into()), size: (320, 180), dir: js.parent().unwrap().to_path_buf(), frame: None }))
|
|
.register_type::<Hq>()
|
|
.add_systems(Update, count);
|
|
let hq = app.world_mut().spawn((Name::new("hq"), Hq::default())).id();
|
|
app.finish();
|
|
app.cleanup();
|
|
// what React showed, beside the World's value then
|
|
let mut seen: Vec<(u32, u32)> = Vec::new();
|
|
for _ in 0..600 {
|
|
app.update();
|
|
let world = app.world().get::<Hq>(hq).map_or(0, |h| h.n);
|
|
let shown = app.world_mut().query::<&ReactText>().iter(app.world()).find_map(|t| t.0.strip_prefix("hq ").map(str::to_string));
|
|
if let Some(n) = shown.and_then(|s| s.parse::<u32>().ok()) {
|
|
if seen.last().map(|s| s.0) != Some(n) {
|
|
seen.push((n, world));
|
|
}
|
|
}
|
|
if seen.iter().filter(|s| s.0 > 100).count() >= 4 {
|
|
break;
|
|
}
|
|
std::thread::sleep(std::time::Duration::from_millis(4));
|
|
}
|
|
// the write binding reached the World (the count starts at 100), and the query answered the World's values (0
|
|
// first, then the count's), in order, never ahead of it
|
|
let after: Vec<_> = seen.iter().filter(|s| s.0 >= 100).collect();
|
|
let ok = after.len() >= 4 && after.windows(2).all(|w| w[1].0 > w[0].0) && seen.iter().all(|(shown, world)| shown <= world);
|
|
let texts: Vec<String> = app.world_mut().query::<&ReactText>().iter(app.world()).map(|t| t.0.clone()).collect();
|
|
println!("host_query: {} (shown, World had: {seen:?}; the page's text at the end: {texts:?})", if ok { "PASS" } else { "FAIL" });
|
|
std::process::exit(if ok { 0 } else { 1 });
|
|
}
|