From 3b829464449e95ce5daa3d57deb22a78c8b0d44b Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 16 Jan 2024 10:21:51 +0100 Subject: [PATCH] Add --copy-demo option to GDExtension setup script --- gdextension/setup_gdextension.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/gdextension/setup_gdextension.sh b/gdextension/setup_gdextension.sh index 480d07b..74f8327 100755 --- a/gdextension/setup_gdextension.sh +++ b/gdextension/setup_gdextension.sh @@ -28,6 +28,8 @@ HIGHLIGHT_COLOR='\033[1;36m' # Light Cyan NC='\033[0m' # No Color ERROR_COLOR="\033[0;31m" # Red +usage() { echo "Usage: $0 [--copy-demo]"; } + msg () { echo -e "$@"; } highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; } error () { echo -e "${ERROR_COLOR}$@${NC}" >&2; } @@ -44,6 +46,22 @@ trap exit SIGINT set -e +copy_demo=0 + +# Parsing arguments +for i in "$@" +do + case "${i}" in + --copy-demo) + copy_demo=1 + shift + ;; + *) + usage + ;; + esac +done + highlight Setup started. if [ ! -d "${PWD}/godot-cpp/" ]; then @@ -62,8 +80,13 @@ else fi if [ ! -e "${PWD}/demo" ]; then - ln -s limboai/demo demo - highlight -- Linked demo project. + if [ ${copy_demo} == 1 ]; then + cp -r limboai/demo demo + highlight -- Copied demo. + else + ln -s limboai/demo demo + highlight -- Linked demo project. + fi else highlight -- Skipping \"demo\". File already exists! fi