diff --git a/CMakeLists.txt b/CMakeLists.txt index f07566c044..8cdcc624e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,9 @@ if(UNIX) # Builds a relocatable binary on Linux. # The Sys folder will need to be copied to the Binaries folder. option(LINUX_LOCAL_DEV "Enable relocatable binary" OFF) + # Builds for AppImage on Linux. + # Dolphin will find all resources using relative paths to the binary. + option(APPIMAGE "Builds for AppImage" OFF) endif() list(APPEND CMAKE_MODULE_PATH @@ -388,8 +391,14 @@ if(ENABLE_LTO) endif() if(UNIX) + if(LINUX_LOCAL_DEV AND APPIMAGE) + message(FATAL_ERROR "Can only specify one of LINUX_LOCAL_DEV and APPIMAGE") + endif() + if(LINUX_LOCAL_DEV) add_definitions(-DLINUX_LOCAL_DEV) + elseif(APPIMAGE) + add_definitions(-DAPPIMAGE) endif() endif() @@ -846,11 +855,11 @@ endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD") # Install the application icon and menu item install(FILES Data/dolphin-emu.svg - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps) + DESTINATION share/icons/hicolor/scalable/apps) install(FILES Data/dolphin-emu.png - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps) + DESTINATION share/icons/hicolor/256x256/apps) install(FILES Data/dolphin-emu.desktop - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) + DESTINATION share/applications) # Install manpages install(FILES Data/dolphin-emu.6 DESTINATION ${CMAKE_INSTALL_MANDIR}/man6) diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 9f17a58675..901a2ad1f3 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -759,7 +759,9 @@ std::string GetExeDirectory() static std::string CreateSysDirectoryPath() { -#if defined(_WIN32) || defined(LINUX_LOCAL_DEV) +#ifdef APPIMAGE +#define SYSDATA_DIR "../share/dolphin-emu/sys" +#elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) #define SYSDATA_DIR "Sys" #elif defined __APPLE__ #define SYSDATA_DIR "Contents/Resources/Sys" @@ -773,7 +775,7 @@ static std::string CreateSysDirectoryPath() #if defined(__APPLE__) const std::string sys_directory = GetBundleDirectory() + DIR_SEP SYSDATA_DIR DIR_SEP; -#elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) +#elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) || defined(APPIMAGE) const std::string sys_directory = GetExeDirectory() + DIR_SEP SYSDATA_DIR DIR_SEP; #elif defined ANDROID const std::string sys_directory = s_android_sys_directory + DIR_SEP; diff --git a/Source/Core/DolphinQt/Translation.cpp b/Source/Core/DolphinQt/Translation.cpp index 1b93536ac9..b13b73302e 100644 --- a/Source/Core/DolphinQt/Translation.cpp +++ b/Source/Core/DolphinQt/Translation.cpp @@ -280,6 +280,9 @@ static bool TryInstallTranslator(const QString& exact_language_code) #elif defined __APPLE__ fmt::format("{}/Contents/Resources/{}.lproj/dolphin-emu.mo", File::GetBundleDirectory(), lang) +#elif defined APPIMAGE + fmt::format("{}/../share/locale/{}/LC_MESSAGES/dolphin-emu.mo", File::GetExeDirectory(), + lang) #elif defined LINUX_LOCAL_DEV fmt::format("{}/../Source/Core/DolphinQt/{}/dolphin-emu.mo", File::GetExeDirectory(), lang) #else