aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-02 00:06:41 +0300
committerGitHub2016-08-02 00:06:41 +0300
commit45e82b55fc70ee88a7717e313e7ed0a0cdc13688 (patch)
tree07f62357dfc8042cd0238753f1f957537e00d7a7 /backends/platform
parent70dc846b952eaf1ffdb67c8820d156a61df2f7df (diff)
parent87818fe63ac851e89513c2fe49c9646d64566b31 (diff)
downloadscummvm-rg350-45e82b55fc70ee88a7717e313e7ed0a0cdc13688.tar.gz
scummvm-rg350-45e82b55fc70ee88a7717e313e7ed0a0cdc13688.tar.bz2
scummvm-rg350-45e82b55fc70ee88a7717e313e7ed0a0cdc13688.zip
Merge pull request #795 from fuzzie/snap
POSIX: Add $SNAP to search path if available.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/posix/posix.cpp16
-rw-r--r--backends/platform/sdl/posix/posix.h2
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