1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

rpcs3: Fix the DATADIR path for AppImage

Even when DATADIR is defined the other paths may still be correct.

Fixes: https://github.com/RPCS3/rpcs3/issues/11195
This commit is contained in:
orbea 2021-11-23 22:40:04 -08:00 committed by Megamouse
parent 4df1a938b1
commit a84223bdc6
3 changed files with 22 additions and 13 deletions

View File

@ -77,9 +77,19 @@ namespace rsx
const std::string image_path = fs::get_config_dir() + "Icons/ui/" + res; const std::string image_path = fs::get_config_dir() + "Icons/ui/" + res;
auto info = std::make_unique<image_info>(image_path.c_str()); auto info = std::make_unique<image_info>(image_path.c_str());
#if !defined(_WIN32) && !defined(__APPLE__) && defined(DATADIR)
// Check the DATADIR if defined
if (info->data == nullptr) if (info->data == nullptr)
{ {
// Resource was not found in config dir, try and grab from relative path (linux) const std::string data_dir (DATADIR);
const std::string image_data = data_dir + "/Icons/ui/" + res;
info = std::make_unique<image_info>(image_data.c_str());
}
#endif
if (info->data == nullptr)
{
// Resource was not found in the DATADIR or config dir, try and grab from relative path (linux)
std::string src = "Icons/ui/" + res; std::string src = "Icons/ui/" + res;
info = std::make_unique<image_info>(src.c_str()); info = std::make_unique<image_info>(src.c_str());
#ifndef _WIN32 #ifndef _WIN32
@ -116,10 +126,7 @@ namespace rsx
if (success) if (success)
{ {
std::string executablePath = dirname(result); std::string executablePath = dirname(result);
#if defined(DATADIR) #ifdef __APPLE__
const std::string dataPath (DATADIR);
src = dataPath + "/Icons/ui/" + res;
#elif defined(__APPLE__)
src = executablePath + "/../Resources/Icons/ui/" + res; src = executablePath + "/../Resources/Icons/ui/" + res;
#else #else
src = executablePath + "/../share/rpcs3/Icons/ui/" + res; src = executablePath + "/../share/rpcs3/Icons/ui/" + res;

View File

@ -518,12 +518,13 @@ void gui_application::OnChangeStyleSheetRequest()
locs << m_gui_settings->GetSettingsDir(); locs << m_gui_settings->GetSettingsDir();
#if !defined(_WIN32) #if !defined(_WIN32)
#if defined(DATADIR) #ifdef __APPLE__
const QString dataPath = (DATADIR);
locs << dataPath + "/GuiConfigs/";
#elif defined(__APPLE__)
locs << QCoreApplication::applicationDirPath() + "/../Resources/GuiConfigs/"; locs << QCoreApplication::applicationDirPath() + "/../Resources/GuiConfigs/";
#else #else
#ifdef DATADIR
const QString data_dir = (DATADIR);
locs << data_dir + "/GuiConfigs/";
#endif
locs << QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/"; locs << QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/";
#endif #endif
locs << QCoreApplication::applicationDirPath() + "/GuiConfigs/"; locs << QCoreApplication::applicationDirPath() + "/GuiConfigs/";

View File

@ -218,13 +218,14 @@ QStringList gui_settings::GetStylesheetEntries() const
QStringList res = gui::utils::get_dir_entries(m_settings_dir, name_filter); QStringList res = gui::utils::get_dir_entries(m_settings_dir, name_filter);
#if !defined(_WIN32) #if !defined(_WIN32)
// Makes stylesheets load if using AppImage (App Bundle) or installed to /usr/bin // Makes stylesheets load if using AppImage (App Bundle) or installed to /usr/bin
#if defined(DATADIR) #ifdef __APPLE__
const QString dataPath = (DATADIR);
QDir platformStylesheetDir = dataPath + "/GuiConfigs/";
#elif defined(__APPLE__)
QDir platformStylesheetDir = QCoreApplication::applicationDirPath() + "/../Resources/GuiConfigs/"; QDir platformStylesheetDir = QCoreApplication::applicationDirPath() + "/../Resources/GuiConfigs/";
#else #else
QDir platformStylesheetDir = QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/"; QDir platformStylesheetDir = QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/";
#ifdef DATADIR
const QString data_dir = (DATADIR);
res.append(gui::utils::get_dir_entries(data_dir + "/GuiConfigs/", name_filter));
#endif
#endif #endif
res.append(gui::utils::get_dir_entries(QCoreApplication::applicationDirPath() + "/GuiConfigs/", name_filter)); res.append(gui::utils::get_dir_entries(QCoreApplication::applicationDirPath() + "/GuiConfigs/", name_filter));
res.append(gui::utils::get_dir_entries(platformStylesheetDir, name_filter)); res.append(gui::utils::get_dir_entries(platformStylesheetDir, name_filter));