From 2b7533cf146ca7dd41901b3f974c6aeca2bb83f7 Mon Sep 17 00:00:00 2001 From: stonifam Date: Thu, 2 Jul 2026 02:17:55 +0400 Subject: [PATCH] fix cwd --- launcher.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/launcher.sh b/launcher.sh index 96770a0..f999c7c 100755 --- a/launcher.sh +++ b/launcher.sh @@ -52,7 +52,8 @@ if [ $# -ge 1 ]; then name_lc=$(echo "${edition_names[$i]}" | tr '[:upper:]' '[:lower:]') arg_lc=$(echo "$arg" | tr '[:upper:]' '[:lower:]') if [ "$arg_lc" = "$name_lc" ]; then - exec "${editions[$i]}" + dir="${editions[$i]%/*}" + cd "$dir" && exec ./run.sh fi done echo -e "${RED}Unknown edition: $arg${NC}" >&2 @@ -78,7 +79,7 @@ if command -v whiptail >/dev/null 2>&1; then case "$choice" in u) run_updater;; q|"") exit 0;; - *) [[ "$choice" =~ ^[0-9]+$ ]] && exec "${editions[$((choice-1))]}" ;; + *) [[ "$choice" =~ ^[0-9]+$ ]] && { d="${editions[$((choice-1))]%/*}"; cd "$d" && exec ./run.sh; } ;; esac done fi @@ -103,7 +104,8 @@ while true; do if [[ "$choice" =~ ^[0-9]+$ ]] && \ [ "$choice" -ge 1 ] && \ [ "$choice" -le "${#editions[@]}" ]; then - exec "${editions[$((choice-1))]}" + d="${editions[$((choice-1))]%/*}" + cd "$d" && exec ./run.sh else echo -e "${RED}Invalid choice${NC}" fi