diff options
-rw-r--r-- | backends/platform/sdl/posix/posix.cpp | 16 | ||||
-rw-r--r-- | backends/platform/sdl/posix/posix.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp index e2a642b288..016a9d44f8 100644 --- a/backends/platform/sdl/posix/posix.cpp +++ b/backends/platform/sdl/posix/posix.cpp @@ -141,6 +141,22 @@ Common::String OSystem_POSIX::getDefaultConfigFileName() { return configFile; } +void OSystem_POSIX::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { + const char *snap = getenv("SNAP"); + if (snap) { + Common::String dataPath = Common::String(snap) + DATA_PATH; + Common::FSNode dataNode(dataPath); + if (dataNode.exists() && dataNode.isDirectory()) { + // This is the same priority which is used for the data path (below), + // but we insert this one first, so it will be searched first. + s.add(dataPath, new Common::FSDirectory(dataNode, 4), priority); + } + } + + // For now, we always add the data path, just in case SNAP doesn't make sense. + OSystem_SDL::addSysArchivesToSearchSet(s, priority); +} + Common::WriteStream *OSystem_POSIX::createLogFile() { // Start out by resetting _logFilePath, so that in case // of a failure, we know that no log file is open. diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h index 0514d30191..050463c273 100644 --- a/backends/platform/sdl/posix/posix.h +++ b/backends/platform/sdl/posix/posix.h @@ -38,6 +38,8 @@ public: virtual void init(); virtual void initBackend(); + virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); + protected: /** * Base string for creating the default path and filename for the |