@@ -12,42 +12,14 @@ index 48fd080..419b40d 100644
1212 # Install the desktop file:
1313 env.Install("$DESTDIR$PREFIX/share/applications", "endless-sky.desktop")
1414diff --git a/source/Files.cpp b/source/Files.cpp
15- index de27023e..4225051f 100644
15+ index f5dec21..ad57c55 100644
1616--- a/source/Files.cpp
1717+++ b/source/Files.cpp
18- @@ -108,32 +108,9 @@ void Files::Init(const char * const *argv)
19- resources = str;
20- SDL_free(str);
18+ @@ -115,6 +115,7 @@ void Files::Init(const char * const *argv)
19+ else if(IsParent(STANDARD_PATH, resources))
20+ resources = STANDARD_PATH / RESOURCE_PATH;
21+ #endif
22+ + resources = "%NIXPKGS_RESOURCES_PATH%";
2123 }
22- - #if defined _WIN32
23- - FixWindowsSlashes(resources);
24- - #endif
25- - if(resources.back() != '/')
26- - resources += '/';
27- - #if defined __linux__ || defined __FreeBSD__ || defined __DragonFly__
28- - // Special case, for Linux: the resource files are not in the same place as
29- - // the executable, but are under the same prefix (/usr or /usr/local).
30- - static const string LOCAL_PATH = "/usr/local/";
31- - static const string STANDARD_PATH = "/usr/";
32- - static const string RESOURCE_PATH = "share/games/endless-sky/";
33- - if(!resources.compare(0, LOCAL_PATH.length(), LOCAL_PATH))
34- - resources = LOCAL_PATH + RESOURCE_PATH;
35- - else if(!resources.compare(0, STANDARD_PATH.length(), STANDARD_PATH))
36- - resources = STANDARD_PATH + RESOURCE_PATH;
37- - #endif
38- - // If the resources are not here, search in the directories containing this
39- - // one. This allows, for example, a Mac app that does not actually have the
40- - // resources embedded within it.
41- - while(!Exists(resources + "credits.txt"))
42- - {
43- - size_t pos = resources.rfind('/', resources.length() - 2);
44- - if(pos == string::npos || pos == 0)
45- - throw runtime_error("Unable to find the resource directories!");
46- - resources.erase(pos + 1);
47- - }
48- +
49- + resources = "%NIXPKGS_RESOURCES_PATH%";
50- +
51- dataPath = resources + "data/";
52- imagePath = resources + "images/";
53- soundPath = resources + "sounds/";
24+ // If the resources are not here, search in the directories containing this
25+ // one. This allows, for example, a Mac app that does not actually have the
0 commit comments