From 993589e10aa5101f4fa729b23fdbe6bb46943bab Mon Sep 17 00:00:00 2001 From: arcadeperfect Date: Tue, 26 Nov 2024 22:30:22 -0500 Subject: [PATCH] try again --- build_wasm.sh | 11 ++++++++++- src/main.rs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build_wasm.sh b/build_wasm.sh index 9195089..bb8cf4c 100755 --- a/build_wasm.sh +++ b/build_wasm.sh @@ -4,4 +4,13 @@ cargo build --release --target wasm32-unknown-unknown wasm-bindgen --out-dir ./out/ --target web ./target/wasm32-unknown-unknown/release/bevy_vaporwave.wasm # sed -i 's/getObject(arg0).focus();/const scrollPos = window.scrollY; getObject(arg0).focus(); window.scrollTo(0, scrollPos);/' ./out/bevy_vaporwave.js -./fix_bindings.sh +# ./fix_bindings.sh + +# Detect OS and use appropriate sed command +if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS + sed -i '' 's/getObject(arg0).focus();/const scrollPos = window.scrollY; getObject(arg0).focus(); window.scrollTo(0, scrollPos);/' ./out/bevy_vaporwave.js +else + # Linux and others + sed -i 's/getObject(arg0).focus();/const scrollPos = window.scrollY; getObject(arg0).focus(); window.scrollTo(0, scrollPos);/' ./out/bevy_vaporwave.js +fi \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 10f57f0..585c3e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -// force build again again +// force build again again again use bevy::gltf::{GltfExtras, GltfSceneExtras}; use bevy::prelude::Color;