From 49ef94d32222838e9a72569b9f81c0673ecd8651 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 5 Apr 2021 14:23:19 +0200 Subject: [PATCH] build_demo_web.sh: fix opening link on windows and linux Co-authored with @DrOptix with code from https://github.com/emilk/egui/pull/246 --- build_demo_web.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/build_demo_web.sh b/build_demo_web.sh index b76eeac8..f9f63579 100755 --- a/build_demo_web.sh +++ b/build_demo_web.sh @@ -29,12 +29,21 @@ TARGET_NAME="${CRATE_NAME}.wasm" wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ --out-dir docs --no-modules --no-typescript -# brew install wabt # to get wasm-strip +# to get wasm-strip: apt/brew/dnf install wabt # wasm-strip docs/${CRATE_NAME}_bg.wasm echo "Optimizing wasm…" -# brew install binaryen # to get wasm-opt +# to get wasm-opt: apt/brew/dnf install binaryen wasm-opt docs/egui_demo_app_bg.wasm -O2 --fast-math -o docs/egui_demo_app_bg.wasm # add -g to get debug symbols echo "Finished docs/${CRATE_NAME}_bg.wasm" -open http://localhost:8888/index.html +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux, ex: Fedora + xdg-open http://localhost:8888/index.html +elif [[ "$OSTYPE" == "msys" ]]; then + # Windows + start http://localhost:8888/index.html +else + # Darwin/MacOS, or something else + open http://localhost:8888/index.html +fi