In setup_gdextension.sh, add options --copy-all and --trash-old
This commit is contained in:
parent
a5728a11a0
commit
7ccda2736d
|
@ -28,7 +28,7 @@ HIGHLIGHT_COLOR='\033[1;36m' # Light Cyan
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
ERROR_COLOR="\033[0;31m" # Red
|
ERROR_COLOR="\033[0;31m" # Red
|
||||||
|
|
||||||
usage() { echo "Usage: $0 [--copy-demo]"; }
|
usage() { echo "Usage: $0 [--copy-demo] [--copy-all] [--trash-old]"; }
|
||||||
|
|
||||||
msg () { echo -e "$@"; }
|
msg () { echo -e "$@"; }
|
||||||
highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; }
|
highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; }
|
||||||
|
@ -47,6 +47,8 @@ trap exit SIGINT
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
copy_demo=0
|
copy_demo=0
|
||||||
|
copy_all=0
|
||||||
|
trash_old=0
|
||||||
|
|
||||||
# Parsing arguments
|
# Parsing arguments
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
|
@ -56,14 +58,40 @@ do
|
||||||
copy_demo=1
|
copy_demo=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--copy-all)
|
||||||
|
copy_demo=1
|
||||||
|
copy_all=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--trash-old)
|
||||||
|
trash_old=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
highlight Setup started.
|
highlight Setup started.
|
||||||
|
|
||||||
|
transfer="ln -s"
|
||||||
|
transfer_word="Linked"
|
||||||
|
if [ ${copy_all} == 1 ]; then
|
||||||
|
transfer="cp -R"
|
||||||
|
transfer_word="Copied"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${trash_old} == 1 ]; then
|
||||||
|
if ! command -v trash &> /dev/null; then
|
||||||
|
error trash command not available. Aborting.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
trash SConstruct limboai/demo/addons demo || /bin/true
|
||||||
|
highlight -- Trashed old setup.
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d "${PWD}/godot-cpp/" ]; then
|
if [ ! -d "${PWD}/godot-cpp/" ]; then
|
||||||
highlight -- Cloning godot-cpp...
|
highlight -- Cloning godot-cpp...
|
||||||
git clone -b ${GODOT_CPP_VERSION} https://github.com/godotengine/godot-cpp
|
git clone -b ${GODOT_CPP_VERSION} https://github.com/godotengine/godot-cpp
|
||||||
|
@ -73,15 +101,15 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "${PWD}/SConstruct" ]; then
|
if [ ! -f "${PWD}/SConstruct" ]; then
|
||||||
ln -s limboai/gdextension/SConstruct SConstruct
|
${transfer} limboai/gdextension/SConstruct SConstruct
|
||||||
highlight -- Linked SConstruct.
|
highlight -- ${transfer_word} SConstruct.
|
||||||
else
|
else
|
||||||
highlight -- Skipping \"SConstruct\". File already exists!
|
highlight -- Skipping \"SConstruct\". File already exists!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${PWD}/demo" ]; then
|
if [ ! -e "${PWD}/demo" ]; then
|
||||||
if [ ${copy_demo} == 1 ]; then
|
if [ ${copy_demo} == 1 ]; then
|
||||||
cp -r limboai/demo demo
|
cp -R limboai/demo demo
|
||||||
highlight -- Copied demo.
|
highlight -- Copied demo.
|
||||||
else
|
else
|
||||||
ln -s limboai/demo demo
|
ln -s limboai/demo demo
|
||||||
|
@ -91,45 +119,31 @@ else
|
||||||
highlight -- Skipping \"demo\". File already exists!
|
highlight -- Skipping \"demo\". File already exists!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if [ -d "${PWD}/demo/" ]; then
|
if [ ! -e "${PWD}/demo/addons/limboai/bin/limboai.gdextension" ]; then
|
||||||
# highlight -- Demo project exists. Archiving...
|
mkdir -p ./demo/addons/limboai/bin/
|
||||||
# backup_version=1
|
cd ./demo/addons/limboai/bin/
|
||||||
# backup_dir="${PWD}/demo.old${backup_version}"
|
if [ -f "../../../../gdextension/limboai.gdextension" ]; then
|
||||||
# while [ -d "${backup_dir}" ]; do
|
${transfer} ../../../../gdextension/limboai.gdextension limboai.gdextension
|
||||||
# ((backup_version++))
|
else
|
||||||
# backup_dir="${PWD}/demo.old${backup_version}"
|
${transfer} ../../../../limboai/gdextension/limboai.gdextension limboai.gdextension
|
||||||
# done
|
fi
|
||||||
# mv demo/ ${backup_dir}
|
|
||||||
# highlight -- Demo project archived as \"$(basename ${backup_dir})\".
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# if [ ! -d "${PWD}/demo/" ]; then
|
|
||||||
# cp -r limboai/demo demo
|
|
||||||
# highlight -- Copied demo project.
|
|
||||||
# else
|
|
||||||
# error Error: \"demo\" directory exists!
|
|
||||||
# exit 2
|
|
||||||
# fi
|
|
||||||
|
|
||||||
if [ ! -e "${PWD}/limboai/demo/addons/limboai/bin/limboai.gdextension" ]; then
|
|
||||||
ls -l
|
|
||||||
mkdir -p ./limboai/demo/addons/limboai/bin/
|
|
||||||
cd ./limboai/demo/addons/limboai/bin/
|
|
||||||
ln -s ../../../../gdextension/limboai.gdextension limboai.gdextension || ln -s ../../../../limboai/gdextension/limboai.gdextension limboai.gdextension
|
|
||||||
ls -l
|
|
||||||
cd -
|
cd -
|
||||||
highlight -- Linked limboai.gdextension.
|
highlight -- ${transfer_word} limboai.gdextension.
|
||||||
else
|
else
|
||||||
highlight -- Skipping limboai.gdextension. File already exists!
|
highlight -- Skipping limboai.gdextension. File already exists!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${PWD}/limboai/demo/addons/limboai/icons/" ]; then
|
if [ ! -e "${PWD}/demo/addons/limboai/icons/" ]; then
|
||||||
cd ./limboai/demo/addons/limboai/
|
cd ./demo/addons/limboai/
|
||||||
ln -s ../../../icons icons || ln -s ../../../limboai/icons icons
|
if [ -d "../../../icons" ]; then
|
||||||
|
${transfer} ../../../icons icons
|
||||||
|
else
|
||||||
|
${transfer} ../../../limboai/icons icons
|
||||||
|
fi
|
||||||
cd -
|
cd -
|
||||||
highlight -- Linked icons.
|
highlight -- ${transfer_word} icons.
|
||||||
else
|
else
|
||||||
highlight -- Skipping linking icons. File already exists!
|
highlight -- Skipping icons. File already exists!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${PYTHON} limboai/gdextension/update_icons.py --silent
|
${PYTHON} limboai/gdextension/update_icons.py --silent
|
||||||
|
|
Loading…
Reference in New Issue