From 3fb2580fc64b784a9383bc97d4432961ae4e3235 Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Tue, 15 Jun 2021 14:14:48 +0700 Subject: [PATCH] Build scripts: check if submodule directories are empty In a freshly cloned repo, submodule directories exist but are not empty. Check if they are empty and update submodules. Previously, submodules where only updated if their directories did not exist. --- addons/godot_xterm/native/build.sh | 4 ++-- misc/export_templates/build.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/godot_xterm/native/build.sh b/addons/godot_xterm/native/build.sh index 42959ad..507ac4e 100755 --- a/addons/godot_xterm/native/build.sh +++ b/addons/godot_xterm/native/build.sh @@ -16,12 +16,12 @@ fi # Update git submodules. LIBTSM_DIR=${NATIVE_DIR}/thirdparty/libtsm -if [ ! -d "$LIBTSM_DIR" ]; then +if [ -z "$(ls -A -- "$LIBTSM_DIR")" ]; then cd ${NATIVE_DIR} git submodule update --init --recursive -- $LIBTSM_DIR fi GODOT_CPP_DIR=${NATIVE_DIR}/thirdparty/godot-cpp -if [ ! -d "${GODOT_CPP_DIR}" ]; then +if [ -z "$(ls -A -- "$GODOT_CPP_DIR")" ]; then cd ${NATIVE_DIR} git submodule update --init --recursive -- $GODOT_CPP_DIR fi diff --git a/misc/export_templates/build.sh b/misc/export_templates/build.sh index e27b5cb..d96d724 100755 --- a/misc/export_templates/build.sh +++ b/misc/export_templates/build.sh @@ -6,7 +6,7 @@ EXPORT_TEMPLATES_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" # Update git submodules. GODOT_DIR=${EXPORT_TEMPLATES_DIR}/godot -if [ ! -d "$GODOT_DIR" ]; then +if [ -z "$(ls -A -- "$GODOT_DIR")" ]; then cd ${EXPORT_TEMPLATES_DIR} git submodule update --init --recursive -- $GODOT_DIR fi