mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
(macOS) Updates to make ES find resources and themes within the application installation directory.
This commit is contained in:
parent
c274a90765
commit
ffcb578fe7
|
@ -603,14 +603,16 @@ std::map<std::string, ThemeSet> ThemeData::getThemeSets()
|
||||||
|
|
||||||
// Check for themes first under the home directory, then under the data installation
|
// Check for themes first under the home directory, then under the data installation
|
||||||
// directory (Unix only) and last under the ES executable directory.
|
// directory (Unix only) and last under the ES executable directory.
|
||||||
#ifdef __unix__
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
static const size_t pathCount = 3;
|
static const size_t pathCount = 3;
|
||||||
#else
|
#else
|
||||||
static const size_t pathCount = 2;
|
static const size_t pathCount = 2;
|
||||||
#endif
|
#endif
|
||||||
std::string paths[pathCount] = {
|
std::string paths[pathCount] = {
|
||||||
Utils::FileSystem::getExePath() + "/themes",
|
Utils::FileSystem::getExePath() + "/themes",
|
||||||
#ifdef __unix__
|
#if defined(__APPLE__)
|
||||||
|
Utils::FileSystem::getExePath() + "/../Resources/themes",
|
||||||
|
#elif defined(__unix__)
|
||||||
Utils::FileSystem::getProgramDataPath() + "/themes",
|
Utils::FileSystem::getProgramDataPath() + "/themes",
|
||||||
#endif
|
#endif
|
||||||
Utils::FileSystem::getHomePath() + "/.emulationstation/themes"
|
Utils::FileSystem::getHomePath() + "/.emulationstation/themes"
|
||||||
|
|
|
@ -44,8 +44,17 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
|
||||||
if (Utils::FileSystem::exists(testHome))
|
if (Utils::FileSystem::exists(testHome))
|
||||||
return testHome;
|
return testHome;
|
||||||
|
|
||||||
|
// For macOS, check in the ../Resources directory relative to the executable directory.
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
std::string applePackagePath =
|
||||||
|
Utils::FileSystem::getExePath() + "/../Resources/resources/" + &path[2];
|
||||||
|
|
||||||
|
if (Utils::FileSystem::exists(applePackagePath)) {
|
||||||
|
return applePackagePath;
|
||||||
|
}
|
||||||
|
|
||||||
// Check under the data installation directory (Unix only).
|
// Check under the data installation directory (Unix only).
|
||||||
#ifdef __unix__
|
#elif defined(__unix__)
|
||||||
std::string testDataPath;
|
std::string testDataPath;
|
||||||
|
|
||||||
testDataPath = Utils::FileSystem::getProgramDataPath() + "/resources/" + &path[2];
|
testDataPath = Utils::FileSystem::getProgramDataPath() + "/resources/" + &path[2];
|
||||||
|
@ -56,9 +65,7 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check under the ES executable directory.
|
// Check under the ES executable directory.
|
||||||
std::string testExePath;
|
std::string testExePath = Utils::FileSystem::getExePath() + "/resources/" + &path[2];
|
||||||
|
|
||||||
testExePath = Utils::FileSystem::getExePath() + "/resources/" + &path[2];
|
|
||||||
|
|
||||||
if (Utils::FileSystem::exists(testExePath)) {
|
if (Utils::FileSystem::exists(testExePath)) {
|
||||||
return testExePath;
|
return testExePath;
|
||||||
|
@ -70,7 +77,9 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
|
||||||
LOG(LogError) << "Program resource missing: " << path;
|
LOG(LogError) << "Program resource missing: " << path;
|
||||||
LOG(LogError) << "Tried to find the resource in the following locations:";
|
LOG(LogError) << "Tried to find the resource in the following locations:";
|
||||||
LOG(LogError) << testHome;
|
LOG(LogError) << testHome;
|
||||||
#ifdef __unix__
|
#if defined(__APPLE__)
|
||||||
|
LOG(LogError) << applePackagePath;
|
||||||
|
#elif defined(__unix__)
|
||||||
LOG(LogError) << testDataPath;
|
LOG(LogError) << testDataPath;
|
||||||
#endif
|
#endif
|
||||||
LOG(LogError) << testExePath;
|
LOG(LogError) << testExePath;
|
||||||
|
|
Loading…
Reference in a new issue