mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-12-22 19:11:54 +01:00
feat: support portable mode (#368)
This commit is contained in:
parent
1c00519938
commit
b0d0cab6c2
10
.github/linux/appimage.sh
vendored
10
.github/linux/appimage.sh
vendored
@ -26,6 +26,12 @@ cp .github/linux/Zelda64Recompiled.desktop AppDir/
|
||||
mv squashfs-root/ deploy
|
||||
./deploy/AppRun --appdir=AppDir/ -d AppDir/Zelda64Recompiled.desktop -i AppDir/Zelda64Recompiled.png -e AppDir/usr/bin/Zelda64Recompiled --plugin gtk
|
||||
sed -i 's/exec/#exec/g' AppDir/AppRun
|
||||
echo 'cd "$this_dir"/usr/bin/' >> AppDir/AppRun
|
||||
echo './Zelda64Recompiled' >> AppDir/AppRun
|
||||
echo 'if [ -f "portable.txt" ]; then' >> AppDir/AppRun
|
||||
echo ' APP_FOLDER_PATH=$PWD' >> AppDir/AppRun
|
||||
echo ' cd "$this_dir"/usr/bin/' >> AppDir/AppRun
|
||||
echo ' APP_FOLDER_PATH=$APP_FOLDER_PATH ./Zelda64Recompiled' >> AppDir/AppRun
|
||||
echo 'else' >> AppDir/AppRun
|
||||
echo ' cd "$this_dir"/usr/bin/' >> AppDir/AppRun
|
||||
echo ' ./Zelda64Recompiled' >> AppDir/AppRun
|
||||
echo 'fi' >> AppDir/AppRun
|
||||
./deploy/usr/bin/linuxdeploy-plugin-appimage --appdir=AppDir
|
||||
|
@ -129,6 +129,11 @@ namespace recomp {
|
||||
}
|
||||
|
||||
std::filesystem::path zelda64::get_app_folder_path() {
|
||||
// directly check for portable.txt (windows and native linux binary)
|
||||
if (std::filesystem::exists("portable.txt")) {
|
||||
return std::filesystem::current_path();
|
||||
}
|
||||
|
||||
std::filesystem::path recomp_dir{};
|
||||
|
||||
#if defined(_WIN32)
|
||||
@ -141,6 +146,11 @@ std::filesystem::path zelda64::get_app_folder_path() {
|
||||
|
||||
CoTaskMemFree(known_path);
|
||||
#elif defined(__linux__)
|
||||
// check for APP_FOLDER_PATH env var used by AppImage
|
||||
if (getenv("APP_FOLDER_PATH") != nullptr) {
|
||||
return std::filesystem::path{getenv("APP_FOLDER_PATH")};
|
||||
}
|
||||
|
||||
const char *homedir;
|
||||
|
||||
if ((homedir = getenv("HOME")) == nullptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user