From b3aa4982f683d961c21fd18e9ffc1fdf5fba0783 Mon Sep 17 00:00:00 2001 From: Cristian Dinu Date: Wed, 24 Mar 2021 13:22:09 +0200 Subject: [PATCH] Adapt the URL open command to the platform With this new version we use $OSTYPE bash env var to query what OS are we running on. - On Linux, ex: Fedora, we use `xdg-open` - On Windows, ex: msys, we use `start` - For other other variants we try to use `open` We should update this script when we notice that `open` is not available on a particular platform. --- build_demo_web.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build_demo_web.sh b/build_demo_web.sh index 4fab5395e..ea267eb1b 100755 --- a/build_demo_web.sh +++ b/build_demo_web.sh @@ -32,4 +32,13 @@ wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ echo "Finished: docs/${CRATE_NAME}.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 + # Darmin aka MacOS or something else + open http://localhost:8888/index.html +fi