From ef4f041385aac0ad12f00e2f66f9e5e3b66383d8 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Tue, 9 Feb 2021 16:27:28 +0100 Subject: [PATCH] Fix AppImage env checks, should works --- libaegisub/unix/path.cpp | 11 +++++------ tools/appimage.bash | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libaegisub/unix/path.cpp b/libaegisub/unix/path.cpp index 934371a64..9097e32ae 100644 --- a/libaegisub/unix/path.cpp +++ b/libaegisub/unix/path.cpp @@ -22,6 +22,8 @@ #include <boost/filesystem/operations.hpp> #include <pwd.h> +#include <iostream> + namespace { #ifndef __APPLE__ std::string home_dir() { @@ -44,17 +46,14 @@ 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) { + /* 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(); diff --git a/tools/appimage.bash b/tools/appimage.bash index 7b402b095..6776781fc 100755 --- a/tools/appimage.bash +++ b/tools/appimage.bash @@ -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 -- GitLab