APP=wxHexEditor
mkdir -p $APP/$APP.AppDir/usr/bin

cd $APP/

wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
. ./functions.sh

wget -c "http://downloads.sourceforge.net/project/wxhexeditor/wxHexEditor/v0.23%20Beta/wxHexEditor-v0.23-Linux_x86_64.tar.bz2"

cd $APP.AppDir/

get_apprun

tar xf ../wxHexEditor-*.tar.bz2
mv wxHexEditor/* usr/bin/
rm -r wxHexEditor/

cat > wxHexEditor.desktop <<\EOF
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=wxHexEditor
GenericName=wxHexEditor
Comment=A hex editor for huge files and devices
Exec=wxHexEditor
Icon=wxHexEditor
Terminal=false
Type=Application
Categories=Utility;TextEditor;
EOF

mkdir -p usr/share/icons/hicolor/48x48/apps
wget "https://sourceforge.net/p/wxhexeditor/code/HEAD/tree/trunk/resources/wxHexEditor.png?format=raw" -O usr/share/icons/hicolor/48x48/apps/wxHexEditor.png

VERSION=$(ls ../wxHexEditor-*.tar.bz2 | cut -d - -f 2 | sed -e 's|v||g')
echo $VERSION

# Add desktop integration
XAPP=wxHexEditor
get_desktopintegration $XAPP.desktop

cd .. # Go out of AppDir

generate_appimage
