forked from void-linux/void-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind-data-files.patch
More file actions
50 lines (43 loc) · 1.68 KB
/
find-data-files.patch
File metadata and controls
50 lines (43 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From d083efb4ab45275940c02bc72e23d334fe596fe7 Mon Sep 17 00:00:00 2001
From: Justin Kinnaird <jkinnaird1991@gmail.com>
Date: Sun, 17 Nov 2019 11:35:21 -0600
Subject: [PATCH 1/2] feat: do resource lookups in standard directories
For Linux, this includes the following directories:
* <HOME>/.local/share/<APPNAME>
* /usr/local/share/<APPNAME>
* /usr/share/<APPNAME>
---
es-core/src/resources/ResourceManager.cpp | 18 ++++++++++++++++++
diff --git a/es-core/src/resources/ResourceManager.cpp b/es-core/src/resources/ResourceManager.cpp
index 9f5014e432..7fd54acea5 100644
--- a/es-core/src/resources/ResourceManager.cpp
+++ b/es-core/src/resources/ResourceManager.cpp
@@ -3,6 +3,10 @@
#include "utils/FileSystemUtil.h"
#include <fstream>
+#ifndef APPDATANAME
+#define APPDATANAME "EmulationStation"
+#endif
+
auto array_deleter = [](unsigned char* p) { delete[] p; };
auto nop_deleter = [](unsigned char* /*p*/) { };
@@ -27,6 +31,20 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
{
std::string test;
+ // check in standard AppData locations
+#if defined(__linux__)
+ test = Utils::FileSystem::getHomePath() + "/.local/share/" + APPDATANAME + "/resources/" + &path[2];
+ if (Utils::FileSystem::exists(test))
+ return test;
+
+ test = std::string("/usr/local/share/") + APPDATANAME + "/resources/" + &path[2];
+ if (Utils::FileSystem::exists(test))
+ return test;
+
+ test = std::string("/usr/share/") + APPDATANAME + "/resources/" + &path[2];
+ if (Utils::FileSystem::exists(test))
+ return test;
+#endif
// check in homepath
test = Utils::FileSystem::getHomePath() + "/.emulationstation/resources/" + &path[2];
if(Utils::FileSystem::exists(test))