Patch the '?data' path when aegisub is launched as an AppImage

This commit is contained in:
Kubat 2021-02-09 14:29:47 +01:00
parent 88d9e9cef6
commit 25f851be7d
No known key found for this signature in database
GPG Key ID: 22432F7DB6FDCA05
2 changed files with 16 additions and 0 deletions

6
.gitignore vendored
View File

@ -36,3 +36,9 @@ subprojects/icu
subprojects/ffmpeg
subprojects/ffms2*
subprojects/boost*
# Build and tag files
cscope.files
git_version.h
git_version.xml
tags

View File

@ -44,7 +44,17 @@ 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) {
agi::fs::path root = ptr_root;
SetToken("?data", root/P_DATA);
} else {
SetToken("?data", P_DATA);
}
#else
SetToken("?data", P_DATA);
#endif
SetToken("?dictionary", "/usr/share/hunspell");
#else
agi::fs::path app_support = agi::util::GetApplicationSupportDirectory();