|
| 1 | +From d083efb4ab45275940c02bc72e23d334fe596fe7 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Justin Kinnaird < [email protected]> |
| 3 | +Date: Sun, 17 Nov 2019 11:35:21 -0600 |
| 4 | +Subject: [PATCH 1/2] feat: do resource lookups in standard directories |
| 5 | + |
| 6 | +For Linux, this includes the following directories: |
| 7 | +* <HOME>/.local/share/<APPNAME> |
| 8 | +* /usr/local/share/<APPNAME> |
| 9 | +* /usr/share/<APPNAME> |
| 10 | +--- |
| 11 | + es-core/src/resources/ResourceManager.cpp | 18 ++++++++++++++++++ |
| 12 | + |
| 13 | +diff --git a/es-core/src/resources/ResourceManager.cpp b/es-core/src/resources/ResourceManager.cpp |
| 14 | +index 9f5014e432..7fd54acea5 100644 |
| 15 | +--- a/es-core/src/resources/ResourceManager.cpp |
| 16 | ++++ b/es-core/src/resources/ResourceManager.cpp |
| 17 | +@@ -3,6 +3,10 @@ |
| 18 | + #include "utils/FileSystemUtil.h" |
| 19 | + #include <fstream> |
| 20 | + |
| 21 | ++#ifndef APPDATANAME |
| 22 | ++#define APPDATANAME "EmulationStation" |
| 23 | ++#endif |
| 24 | ++ |
| 25 | + auto array_deleter = [](unsigned char* p) { delete[] p; }; |
| 26 | + auto nop_deleter = [](unsigned char* /*p*/) { }; |
| 27 | + |
| 28 | +@@ -27,6 +31,20 @@ std::string ResourceManager::getResourcePath(const std::string& path) const |
| 29 | + { |
| 30 | + std::string test; |
| 31 | + |
| 32 | ++ // check in standard AppData locations |
| 33 | ++#if defined(__linux__) |
| 34 | ++ test = Utils::FileSystem::getHomePath() + "/.local/share/" + APPDATANAME + "/resources/" + &path[2]; |
| 35 | ++ if (Utils::FileSystem::exists(test)) |
| 36 | ++ return test; |
| 37 | ++ |
| 38 | ++ test = std::string("/usr/local/share/") + APPDATANAME + "/resources/" + &path[2]; |
| 39 | ++ if (Utils::FileSystem::exists(test)) |
| 40 | ++ return test; |
| 41 | ++ |
| 42 | ++ test = std::string("/usr/share/") + APPDATANAME + "/resources/" + &path[2]; |
| 43 | ++ if (Utils::FileSystem::exists(test)) |
| 44 | ++ return test; |
| 45 | ++#endif |
| 46 | + // check in homepath |
| 47 | + test = Utils::FileSystem::getHomePath() + "/.emulationstation/resources/" + &path[2]; |
| 48 | + if(Utils::FileSystem::exists(test)) |
| 49 | + |
| 50 | + |
0 commit comments