Skip to content

armgit / raea

Public Imported from GitHub
0

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.

Windows: engine/render's canonicalize goes through dunce, the sweep's last

shinyobjectz450d87398482
diff --git a/Cargo.lock b/Cargo.lock
index e2842e60..a1bd6812 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -14851,6 +14851,7 @@ version = "0.1.0"
dependencies = [
"bevy",
"bytemuck",
+ "dunce",
"image",
"raea-core-program",
"raea-core-shape",
diff --git a/engine/render/Cargo.toml b/engine/render/Cargo.toml
index d95bf25e..6d3042a5 100644
--- a/engine/render/Cargo.toml
+++ b/engine/render/Cargo.toml
@@ -7,6 +7,7 @@ publish = false
description = "raea's render engine: an edit's rows drawn by Bevy (3D) or the direct GPU path, its sound mixed, its video encoded"
[dependencies]
+dunce = "1"
# a frame's rows as the passes read them (FrameRows, the edit, the clock, row helpers, bevy_api)
raea-sys-frame = { path = "../../systems/frame" }
# a part held where a hand has it, and wireframe (the app's scene inspector)
diff --git a/engine/render/src/lib.rs b/engine/render/src/lib.rs
index 349e2816..132ea12f 100644
--- a/engine/render/src/lib.rs
+++ b/engine/render/src/lib.rs
@@ -29,7 +29,7 @@ pub fn inserted_of(p: &Program) -> Vec<Tup> {
}
pub fn dir_of(path: &str) -> PathBuf {
- std::fs::canonicalize(Path::new(path).parent().filter(|d| !d.as_os_str().is_empty()).unwrap_or(Path::new("."))).unwrap_or_else(|_| PathBuf::from("."))
+ dunce::canonicalize(Path::new(path).parent().filter(|d| !d.as_os_str().is_empty()).unwrap_or(Path::new("."))).unwrap_or_else(|_| PathBuf::from("."))
}
pub fn save_png(path: &Path, rgba: &[u8], w: u32, h: u32) -> Result<(), String> {
diff --git a/tools/windows-paths.sh b/tools/windows-paths.sh
index 433d8413..fcecb776 100755
--- a/tools/windows-paths.sh
+++ b/tools/windows-paths.sh
@@ -13,11 +13,6 @@
#
# Comment lines don't count. Not checked: vendored crates (not ours), and for the home folder two test tools for the
# Mac and Unix only, each its own workspace (Unix PATH strings, ~/Library/Caches): sdk/ui/conformance and sdk/ui/parity.
-#
-# WAITING: a file whose fix is on a branch of its own that hasn't landed yet, so the check holds at zero everywhere
-# else meanwhile. A waiting file with nothing left to fix fails, so the list only shrinks:
-# engine/render/src/lib.rs the texture folder's canonicalize (windows-paths-render)
-WAITING=(engine/render/src/lib.rs)
set -u
ROOT=$(cd "$(dirname "$0")/.." && pwd)
cd "$ROOT" || exit 2
@@ -27,15 +22,6 @@ code() { grep -v -E '^[^:]+:[0-9]+:[[:space:]]*//'; }
canon=$(git grep -n -E '\.canonicalize\(\)|(^|[^A-Za-z0-9_:])(std::)?fs::canonicalize\(|tokio::fs::canonicalize\(' -- '*.rs' "${NOT_OURS[@]}" | code)
home=$(git grep -n -E 'env::var(_os)?\("HOME"\)' -- '*.rs' "${NOT_OURS[@]}" "${MAC_TOOLS[@]}" | code | grep -v USERPROFILE)
status=0
-waits=()
-for w in ${WAITING[@]+"${WAITING[@]}"}; do
- if grep -q "^$w:" <<< "$canon"$'\n'"$home"; then
- canon=$(grep -v "^$w:" <<< "$canon"); home=$(grep -v "^$w:" <<< "$home"); waits+=("$w")
- else
- echo "windows-paths: $w has nothing left to fix; take it off WAITING (tools/windows-paths.sh)"
- status=1
- fi
-done
if [ -n "$canon" ]; then
echo "windows-paths: canonicalize() through std gives \\\\?\\C:\\... on Windows; use dunce::canonicalize(&path):"
printf ' %s\n' "${canon//$'\n'/$'\n' }"
@@ -46,5 +32,5 @@ if [ -n "$home" ]; then
printf ' %s\n' "${home//$'\n'/$'\n' }"
status=1
fi
-[ $status = 0 ] && echo "windows-paths: ok (every canonicalize through dunce, every home folder through user_home${waits[0]+; waiting: ${waits[*]}})"
+[ $status = 0 ] && echo "windows-paths: ok (every canonicalize through dunce, every home folder through user_home)"
exit $status