make `argv[0]` in AppImage reliable to fix configuration file path (#109)
This commit is contained in:
parent
cc5e6d1dab
commit
4190826c52
|
@ -2,6 +2,9 @@
|
|||
|
||||
set -xe
|
||||
|
||||
VERSION=$(sed -nr -e '/APP_VERSION\s*=/ s/APP_VERSION\s*=\s*(([0-9]+\.)*[0-9]+)\s*/\1/p' /build/RedPanda-CPP/Red_Panda_CPP.pro)
|
||||
APPIMAGE_FILE=RedPandaIDE-$VERSION-$CARCH.AppImage
|
||||
|
||||
# build RedPanda C++
|
||||
mkdir -p /build/redpanda-build
|
||||
cd /build/redpanda-build
|
||||
|
@ -13,18 +16,19 @@ make install INSTALL_ROOT=/build/RedPandaIDE.AppDir
|
|||
|
||||
# setup AppImage resource
|
||||
cd /build/RedPandaIDE.AppDir
|
||||
ln -s usr/bin/RedPandaIDE AppRun
|
||||
ln -s usr/share/applications/redpandaide.desktop redpandaide.desktop
|
||||
ln -s usr/share/icons/hicolor/scalable/apps/redpandaide.svg redpandaide.svg
|
||||
cp /build/RedPanda-CPP/platform/linux/redpandaide.png .DirIcon
|
||||
# following files may come from Windows filesystem, use `install` to preseve file permission
|
||||
install -m755 /build/RedPanda-CPP/packages/appimage/AppRun.sh AppRun
|
||||
install -m644 /build/RedPanda-CPP/platform/linux/redpandaide.png .DirIcon
|
||||
|
||||
# copy dependency
|
||||
cp /usr/local/bin/alacritty usr/bin
|
||||
|
||||
# create AppImage
|
||||
cd /build
|
||||
appimagetool --appimage-extract-and-run RedPandaIDE.AppDir RedPandaIDE-$CARCH.AppImage
|
||||
appimagetool --appimage-extract-and-run RedPandaIDE.AppDir $APPIMAGE_FILE
|
||||
|
||||
# copy back to host
|
||||
mkdir -p /build/RedPanda-CPP/dist
|
||||
cp RedPandaIDE-$CARCH.AppImage /build/RedPanda-CPP/dist
|
||||
cp $APPIMAGE_FILE /build/RedPanda-CPP/dist
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# AppImage runtime set `argv[0]` to AppImage file, which is not reliable.
|
||||
# Qt framework expects reliable `argv[0]` to locate configuration files.
|
||||
# This wrapper fixes `argv[0]`.
|
||||
|
||||
exec "$(dirname "$0")/usr/bin/RedPandaIDE" "$@"
|
Loading…
Reference in New Issue