From af4960a5a5f31d353f99cb718c88f48e05690f5b Mon Sep 17 00:00:00 2001 From: Jhen Date: Thu, 17 Aug 2023 20:30:48 +0800 Subject: [PATCH] server : attempt use valid xxd command on linux --- examples/server/deps.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/server/deps.sh b/examples/server/deps.sh index 4e5262ff9..512636bae 100755 --- a/examples/server/deps.sh +++ b/examples/server/deps.sh @@ -12,9 +12,17 @@ if [ "$1" != "--no-download" ]; then fi FILES=$(ls $PUBLIC) +UNAME_S=$(uname -s) for FILE in $FILES; do func=$(echo $FILE | tr '.' '_') echo "generate $FILE.hpp ($func)" - xxd -n $func -i $PUBLIC/$FILE > $DIR/$FILE.hpp + + if [ "$UNAME_S" == "Darwin" ]; then + xxd -n $func -i $PUBLIC/$FILE > $DIR/$FILE.hpp + elif [ "$UNAME_S" == "Linux" ]; then + xxd -i $PUBLIC/$FILE > $DIR/$FILE.hpp + replace_prefix="$(echo $PUBLIC | tr '/' '_')_" + sed -i "s/$replace_prefix//g" $DIR/$FILE.hpp + fi done