From d8dc494afa590d79208fcaefff44516791e93bc5 Mon Sep 17 00:00:00 2001 From: Minimons Date: Thu, 6 Aug 2026 16:43:37 +0200 Subject: [PATCH] X: Statup checks for missing configs --- run.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index 8678a0d..5948fe5 100755 --- a/run.sh +++ b/run.sh @@ -1,11 +1,20 @@ #!/usr/bin/env bash set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" + +LOG4J_CONFIG="conf/log4j2.xml" + +if [[ ! -r "$LOG4J_CONFIG" || ! -s "$LOG4J_CONFIG" ]]; then + echo "ERROR: Log4j2 configuration file is missing, unreadable, or empty: $PWD/$LOG4J_CONFIG" >&2 + exit 1 +fi + shopt -s nullglob jars=(libs/*.jar) if (( ${#jars[@]} == 0 )); then - echo "ERROR: No JARs found in libs/" >&2 + echo "ERROR: No JARs found in $PWD/libs/" >&2 exit 1 fi @@ -14,6 +23,6 @@ CLASSPATH=$(IFS=:; echo "${jars[*]}") exec java \ --enable-native-access=javafx.graphics \ --enable-preview \ - -Dlog4j.configurationFile=conf/log4j2.xml \ + "-Dlog4j.configurationFile=$LOG4J_CONFIG" \ -cp "$CLASSPATH" \ com.r35157.nenjim.hubd.impl.ref.Main