From c657bb124461ada68e1636e20bfc1804976f942a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=9D=E7=AE=94?= <38349409+Sodium-Aluminate@users.noreply.github.com> Date: Wed, 8 Oct 2025 18:34:11 +0800 Subject: [PATCH] fix #84 --- assets/nix/run.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/nix/run.sh b/assets/nix/run.sh index 5669ec9..3b97dc1 100755 --- a/assets/nix/run.sh +++ b/assets/nix/run.sh @@ -103,11 +103,6 @@ if [ -x "$1" ] ; then shift fi -if [ -z "${executable_name}" ] || [ ! -x "${executable_name}" ]; then - echo "Please set executable_name to a valid name in a text editor or as the first command line parameter" 1>&2 - exit 1 -fi - # Use POSIX-compatible way to get the directory of the executable a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a" || exit; pwd -P) @@ -123,16 +118,21 @@ abs_path() { echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" } +real_executable_name="$(abs_path "$executable_name")" + +if [ -z "${executable_name}" ] || [ ! -x "${real_executable_name}" ]; then + echo "Please set executable_name to a valid name in a text editor or as the first command line parameter" 1>&2 + exit 1 +fi + # Set executable path and the extension to use for the libdoorstop shared object os_type="$(uname -s)" case ${os_type} in Linux*) - executable_path="$(abs_path "$executable_name")" + executable_path="$real_executable_name" lib_extension="so" ;; Darwin*) - real_executable_name="$(abs_path "$executable_name")" - # If we're not even an actual executable, check .app Info for actual executable case $real_executable_name in *.app/Contents/MacOS/*)