mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Moved the CMake install prefix function to FileSystemUtil and implemented the same logic also for theme loading.
This commit is contained in:
parent
8fefc9232c
commit
b560429a20
2
NEWS.md
2
NEWS.md
|
@ -18,6 +18,8 @@ v1.0.0
|
||||||
* GUI-configurable option to sort favorite games on the top of the game lists (favorites marked with stars)
|
* GUI-configurable option to sort favorite games on the top of the game lists (favorites marked with stars)
|
||||||
* Added new component GuiComplexTextEditPopup to handle changes to configuration file entries and similar
|
* Added new component GuiComplexTextEditPopup to handle changes to configuration file entries and similar
|
||||||
* Speed improvements and optimizations, the application now starts faster and feels more responsive
|
* Speed improvements and optimizations, the application now starts faster and feels more responsive
|
||||||
|
* Moved all resources to a subdirectory structure and enabled the CMake install prefix variable to generate the resources search path
|
||||||
|
* Changed theme directory to the install prefix (e.g. /usr/local/share/emulationstation/themes) with themes in the home directory taking precedence
|
||||||
* Refactoring, cleanup and documentation of the source code, removal of deprecated files etc.
|
* Refactoring, cleanup and documentation of the source code, removal of deprecated files etc.
|
||||||
* All required fonts bundled with the application, no dependencies on the OS to provide them any longer
|
* All required fonts bundled with the application, no dependencies on the OS to provide them any longer
|
||||||
* License files included for all the libraries and resources that are bundled with the application
|
* License files included for all the libraries and resources that are bundled with the application
|
||||||
|
|
|
@ -592,10 +592,12 @@ std::map<std::string, ThemeSet> ThemeData::getThemeSets()
|
||||||
{
|
{
|
||||||
std::map<std::string, ThemeSet> sets;
|
std::map<std::string, ThemeSet> sets;
|
||||||
|
|
||||||
|
// Check for themes under the data installation directory (install prefix), as well
|
||||||
|
// as under the user home directory.
|
||||||
static const size_t pathCount = 2;
|
static const size_t pathCount = 2;
|
||||||
std::string paths[pathCount] =
|
std::string paths[pathCount] =
|
||||||
{
|
{
|
||||||
"/etc/emulationstation/themes",
|
Utils::FileSystem::getInstallPrefixPath() + "/emulationstation/themes",
|
||||||
Utils::FileSystem::getHomePath() + "/.emulationstation/themes"
|
Utils::FileSystem::getHomePath() + "/.emulationstation/themes"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,6 @@
|
||||||
#include "utils/FileSystemUtil.h"
|
#include "utils/FileSystemUtil.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#ifdef ES_INSTALL_PREFIX
|
|
||||||
std::string installPrefix = ES_INSTALL_PREFIX;
|
|
||||||
#else
|
|
||||||
std::string installPrefix = "/usr/local";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ES_DATAROOTDIR
|
|
||||||
std::string dataRootDir = ES_DATAROOTDIR;
|
|
||||||
#else
|
|
||||||
std::string dataRootDir = "share";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto array_deleter = [](unsigned char* p) { delete[] p; };
|
auto array_deleter = [](unsigned char* p) { delete[] p; };
|
||||||
auto nop_deleter = [](unsigned char* /*p*/) { };
|
auto nop_deleter = [](unsigned char* /*p*/) { };
|
||||||
|
|
||||||
|
@ -50,12 +38,9 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
|
||||||
if (Utils::FileSystem::exists(test))
|
if (Utils::FileSystem::exists(test))
|
||||||
return test;
|
return test;
|
||||||
|
|
||||||
// Check under the data installation directory.
|
// Check under the data installation directory (install prefix).
|
||||||
// The base directory is the value set for CMAKE_INSTALL_DIRECTORY during build.
|
test = Utils::FileSystem::getInstallPrefixPath() +
|
||||||
// The datarootdir directory is the value set for CMAKE_INSTALL_DATAROOTDIR during build.
|
"/emulationstation/resources/" + &path[2];
|
||||||
// If not defined, the default prefix path '/usr/local' and the default datarootdir
|
|
||||||
// directory 'share' will be used, i.e. '/usr/local/share'.
|
|
||||||
test = installPrefix + "/" + dataRootDir + "/emulationstation/resources/" + &path[2];
|
|
||||||
if (Utils::FileSystem::exists(test))
|
if (Utils::FileSystem::exists(test))
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,23 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
// Try to ascertain the install prefix as defined when CMake was run.
|
||||||
|
// The installPrefix directory is the value set for CMAKE_INSTALL_DIRECTORY during build.
|
||||||
|
// The datarootdir directory is the value set for CMAKE_INSTALL_DATAROOTDIR during build.
|
||||||
|
// If not defined, the default prefix path '/usr/local' and the default datarootdir
|
||||||
|
// directory 'share' will be used, i.e. combining to '/usr/local/share'.
|
||||||
|
#ifdef ES_INSTALL_PREFIX
|
||||||
|
std::string installPrefix = ES_INSTALL_PREFIX;
|
||||||
|
#else
|
||||||
|
std::string installPrefix = "/usr/local";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ES_DATAROOTDIR
|
||||||
|
std::string dataRootDir = ES_DATAROOTDIR;
|
||||||
|
#else
|
||||||
|
std::string dataRootDir = "share";
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
namespace FileSystem
|
namespace FileSystem
|
||||||
|
@ -221,6 +238,11 @@ namespace Utils
|
||||||
|
|
||||||
} // getExePath
|
} // getExePath
|
||||||
|
|
||||||
|
std::string getInstallPrefixPath()
|
||||||
|
{
|
||||||
|
return installPrefix + "/" + dataRootDir;
|
||||||
|
}
|
||||||
|
|
||||||
std::string getPreferredPath(const std::string& _path)
|
std::string getPreferredPath(const std::string& _path)
|
||||||
{
|
{
|
||||||
std::string path = _path;
|
std::string path = _path;
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace Utils
|
||||||
std::string getCWDPath ();
|
std::string getCWDPath ();
|
||||||
void setExePath (const std::string& _path);
|
void setExePath (const std::string& _path);
|
||||||
std::string getExePath ();
|
std::string getExePath ();
|
||||||
|
std::string getInstallPrefixPath ();
|
||||||
std::string getPreferredPath (const std::string& _path);
|
std::string getPreferredPath (const std::string& _path);
|
||||||
std::string getGenericPath (const std::string& _path);
|
std::string getGenericPath (const std::string& _path);
|
||||||
std::string getEscapedPath (const std::string& _path);
|
std::string getEscapedPath (const std::string& _path);
|
||||||
|
|
Loading…
Reference in a new issue