From 6fefaf9081d8537e37080af4edc8850bb91d2fc2 Mon Sep 17 00:00:00 2001 From: Branko May Trinkwald Date: Sun, 21 Dec 2025 19:54:13 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9A=20Fix:=20zsh=20Pfad-Berechnung=20m?= =?UTF-8?q?it=20${(%):-%x}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KRITISCHER FIX: BASH_SOURCE[0] funktioniert nicht in zsh! Problem: - BASH_SOURCE[0] ist bash-spezifisch - In zsh war SCRIPT_DIR leer → WALDWAECHTER_DIR falsch - CRUMB_LOGS_DIR: /Users/bmt/Documents/logs (falsch!) - Sollte: /Users/bmt/Documents/CF_Zero_V1/logs Lösung: - if BASH_VERSION → BASH_SOURCE[0] - elif ZSH_VERSION → ${(%):-%x} - else → fallback $0 Jetzt funktionieren Pfade in beiden Shells korrekt! crew_doctor wird jetzt den richtigen Pfad zeigen ✅ 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 --- lib/waldwaechter.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/waldwaechter.sh b/lib/waldwaechter.sh index 76a160c..74cb3d8 100644 --- a/lib/waldwaechter.sh +++ b/lib/waldwaechter.sh @@ -3,7 +3,18 @@ # Source this file to make all AI characters available as commands # Determine the repo root directory (lib/ is inside repo root) -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Support both bash and zsh +if [[ -n "$BASH_VERSION" ]]; then + # Bash: use BASH_SOURCE + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +elif [[ -n "$ZSH_VERSION" ]]; then + # Zsh: use ${(%):-%x} to get the script path + SCRIPT_DIR="$(cd "$(dirname "${(%):-%x}")" && pwd)" +else + # Fallback: use $0 (may not work when sourced) + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +fi + WALDWAECHTER_DIR="$(dirname "$SCRIPT_DIR")" ROLES_DIR="${WALDWAECHTER_DIR}/crumbforest_roles"