diff --git a/XaoS.pro b/XaoS.pro index 7704c641..bbfae47e 100644 --- a/XaoS.pro +++ b/XaoS.pro @@ -88,6 +88,7 @@ wasm{ QMAKE_LFLAGS += --preload-file $$PWD/catalogs@$$DATAPATH/catalogs QMAKE_LFLAGS += --preload-file $$PWD/tutorial@$$DATAPATH/tutorial QMAKE_LFLAGS += -sASYNCIFY -Os # This can help avoiding to get the web application hang when the user presses "s". + QMAKE_POST_LINK = $$PWD/tools/set-document-title $$PWD/bin } executable.files = bin/xaos executable.path = $$PREFIX/bin diff --git a/tools/set-document-title b/tools/set-document-title new file mode 100755 index 00000000..bbac39df --- /dev/null +++ b/tools/set-document-title @@ -0,0 +1,24 @@ +#!/bin/bash + +# This script sets the document title for the WebAssembly version in xaos.js. + +set -e + +if [ "$1" = "" ]; then + echo "Usage: $0 [bin-folder]" + exit 1 + fi + +test "$1/xaos.js" || { + echo "The file $1/xaos.js is missing." + exit 2 + } + +# This will not work on macOS, FIXME: +sed -i 's/Module\["print"\]/\ + function mymessage(t) {\ + let statustext = "STATUS: ";\ + if (t.startsWith(statustext)) document.title = t.substring(statustext.length);\ + }\ +/' "$1/xaos.js" +# For a workaround on macOS, see https://stackoverflow.com/questions/12696125/sed-edit-file-in-place