io/appimage: Correctly handle appdir for static and shared assets

This commit is contained in:
Pedro Montes Alcalde 2023-11-22 12:17:44 -03:00 committed by GitHub
parent 072e9192ea
commit 201777fac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -108,13 +108,23 @@
{
"name": "linux-ninja-clang15-appimage",
"inherits": "linux-ninja-clang15",
"displayName": "Linux AppImage with Ninja and Clang",
"displayName": "Linux AppImage with Ninja and Clang 15",
"description": "Linux AppImage build using Ninja Multi-Config generator and Clang 15 compiler",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "/usr",
"BUILD_APPIMAGE": true
}
},
{
"name": "linux-ninja-clang-appimage",
"inherits": "linux-ninja-clang",
"displayName": "Linux AppImage with Ninja and Clang",
"description": "Linux AppImage build using Ninja Multi-Config generator and Clang compiler",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "/usr",
"BUILD_APPIMAGE": true
}
},
{
"name": "linux-ninja-gnu",
"inherits": "linux-ninja",

View file

@ -1,4 +1,4 @@
#!/bin/sh
if [ "${APPIMAGE}" != "" ]; then
XDG_DATA_DIRS="${APPDIR}/usr/share:${XDG_DATA_DIRS}" "${APPDIR}/usr/bin/Vita3K" $@
"${APPDIR}/usr/bin/Vita3K" $@
fi

View file

@ -123,6 +123,7 @@ void init_paths(Root &root_paths) {
auto XDG_DATA_HOME = getenv("XDG_DATA_HOME");
auto XDG_CACHE_HOME = getenv("XDG_CACHE_HOME");
auto XDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME");
auto APPDIR = getenv("APPDIR"); // Used in AppImage
if (XDG_DATA_HOME != NULL)
root_paths.set_pref_path(fs::path(XDG_DATA_HOME) / app_name / app_name / dir_sep);
@ -159,6 +160,10 @@ void init_paths(Root &root_paths) {
root_paths.set_static_assets_path(fs::path(XDG_DATA_HOME) / app_name / dir_sep);
}
if (APPDIR != NULL) {
root_paths.set_static_assets_path(fs::path(APPDIR) / "usr/share/Vita3K");
}
// shared path
if (env_home != NULL)
root_paths.set_shared_path(fs::path(env_home) / ".local/share" / app_name / dir_sep);