@@ -70,22 +70,30 @@ for hook in "$CURRENTDIR"/bin/*.src.hook; do
7070 . " $hook "
7171done
7272
73+ # always unset ARGVO to avoid causing issues to child processes that use zsh
74+ # We do it after running the hooks since some hooks need it
7375unset ARGV0
7476
77+ # Check if BIN (ARGV0) matches a binary, fallback to $1, then binary in .desktop
78+ if [ -f " $CURRENTDIR " /bin/" $BIN " ]; then
79+ TO_LAUNCH=" $CURRENTDIR " /bin/" $BIN "
80+ elif [ -f " $CURRENTDIR " /bin/" $1 " ]; then
81+ TO_LAUNCH=" $CURRENTDIR " /bin/" $1 "
82+ shift
83+ else
84+ TO_LAUNCH=" $CURRENTDIR " /bin/" $MAIN_BIN "
85+ fi
86+
7587# If LD_DEBUG=libs is set outside the AppImage the output is not helpful
7688# because it will include the libs of sh, grep, cat, etc from the hooks
7789# with this var we can set LD_DEBUG=libs for the bundled application only
7890if [ " $APPIMAGE_DEBUG " = 1 ]; then
7991 export LD_DEBUG=libs
80- fi
81-
82- # Check if ARGV0 matches any bundled binary, fallback to $1, then main bin
83- if [ -f " $CURRENTDIR " /bin/" $BIN " ]; then
84- exec " $CURRENTDIR " /bin/" $BIN " " $@ "
85- elif [ -f " $CURRENTDIR " /bin/" $1 " ]; then
86- BIN=" $1 "
87- shift
88- exec " $CURRENTDIR " /bin/" $BIN " " $@ "
92+ export VK_LOADER_DEBUG=all
93+ export LC_ALL=C
94+ export SHARUN_PRINTENV=1
95+ " $TO_LAUNCH " " $@ " 2> " $HOME " /" ${APPIMAGE##*/ } " -debug.log
96+ >&2 echo " Debug log at: '$HOME /${APPIMAGE##*/ } -debug.log'"
8997else
90- exec " $CURRENTDIR " /bin/ " $MAIN_BIN " " $@ "
98+ exec " $TO_LAUNCH " " $@ "
9199fi
0 commit comments