Fix AppImage env checks, should works. This is C++11, not C++17, don't use declaration inside if statements

This commit is contained in:
Kubat 2021-02-09 16:27:28 +01:00
parent e90e3aa5da
commit fd3362ae2e
No known key found for this signature in database
GPG Key ID: 22432F7DB6FDCA05
3 changed files with 11 additions and 7 deletions

View File

@ -22,6 +22,8 @@
#include <boost/filesystem/operations.hpp>
#include <pwd.h>
#include <iostream>
namespace {
#ifndef __APPLE__
std::string home_dir() {
@ -44,17 +46,15 @@ void Path::FillPlatformSpecificPaths() {
agi::fs::path home = home_dir();
SetToken("?user", home/".aegisub");
SetToken("?local", home/".aegisub");
#ifdef __linux__
/* AppImage case */
if (const char *ptr_root = getenv("APPDIR"); ptr_root != nullptr) {
const char *ptr_root = getenv("APPDIR");
if (ptr_root != nullptr) {
/* AppImage case */
agi::fs::path root = ptr_root;
SetToken("?data", root/P_DATA);
SetToken("?data", root/"usr/share/aegisub/");
} else {
/* No AppImage */
SetToken("?data", P_DATA);
}
#else
SetToken("?data", P_DATA);
#endif
SetToken("?dictionary", "/usr/share/hunspell");
#else
agi::fs::path app_support = agi::util::GetApplicationSupportDirectory();

View File

@ -71,6 +71,7 @@ void ShowAboutDialog(wxWindow *parent) {
" Rodrigo Braz Monteiro\n"
" Simone Cociancich\n"
" Thomas Goyne\n"
" Maël Martin\n"
"User manual written by:\n"
" Karl Blomster\n"
" Niels Martin Hansen\n"

View File

@ -33,9 +33,12 @@ chmod +x "$APPIMAGETOOL" "$LINUXDEPLOY"
cp packages/desktop/aegisub.desktop.template.in AppImage/aegisub.desktop || exit 1;
cp packages/desktop/64x64.png AppImage/aegisub.png || exit 1;
sed -i -e 's/@AEGISUB_COMMAND@/aegisub/g' AppImage/aegisub.desktop || exit 1;
rm AppImage/Aegisub/usr/bin/aegisub
$LINUXDEPLOY \
--appdir AppImage/Aegisub \
--icon-file AppImage/aegisub.png \
--desktop-file AppImage/aegisub.desktop \
--executable "$AEGISUB" || exit 1;
mkdir -p AppImage/Aegisub/usr/share/aegisub/automation || exit 1;
cp -rv automation/* AppImage/Aegisub/usr/share/aegisub/automation/
$APPIMAGETOOL AppImage/Aegisub