Skip to content

Commit

Permalink
Search for main binary based on the name of the AppDir, AppRun, or th…
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd committed Apr 22, 2023
1 parent e0d917f commit 44951e8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/appimagetool/appdirtool.go
Expand Up @@ -102,8 +102,28 @@ fi
############################################################################################
cd "$HERE/usr" # Not all applications will need this; TODO: Make this opt-in
MAIN_BIN=$(find "$HERE/usr/bin" -name "$MAIN" | head -n 1)
# Try to find a binary with the same name as the AppImage or the symlink through which
# it was invoked, without any suffix
if [ -z "$ARGV0" ] ; then
# AppRun is being executed outside of an AppImage
ARGV0="$0"
fi
BINARY_NAME=$(basename "$ARGV0")
if [ "$BINARY_NAME" == "AppRun" ] ; then
unset BINARY_NAME
fi
BINARY_NAME="${BINARY_NAME%.*}" # remove everything after the last "."
MAIN_BIN=$(find "$HERE/usr/bin" -name "$BINARY_NAME" | head -n 1)
# Fall back to finding the main binary based on the Exec= line in the desktop file
if [ -z "$MAIN_BIN" ] ; then
MAIN_BIN=$(find "$HERE/usr/bin" -name "$MAIN" | head -n 1)
fi
LD_LINUX=$(find "$HERE" -name 'ld-*.so.*' | head -n 1)
if [ -e "$LD_LINUX" ] ; then
export GCONV_PATH="$HERE/usr/lib/gconv"
export FONTCONFIG_FILE="$HERE/etc/fonts/fonts.conf"
Expand Down

0 comments on commit 44951e8

Please sign in to comment.