summaryrefslogtreecommitdiff
blob: 365aa7c69d613ac54bdf6b2d0f872859abf56970 (plain)
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
--- a/OgreMain/src/OgreConfigFile.cpp	2018-07-27 07:52:31.121337386 +0200
+++ b/OgreMain/src/OgreConfigFile.cpp	2018-07-27 07:59:51.301317661 +0200
@@ -62,8 +62,25 @@
     //-----------------------------------------------------------------------
     void ConfigFile::load(const String& filename, const String& separators, bool trimWhitespace)
     {
-        loadDirect(filename, separators, trimWhitespace);
+        // Try automatic loading first
+        try {
+            loadDirect(filename, separators, trimWhitespace);
+        } catch (Exception &e) {
+            // Try /etc/OGRE/<file> next
+            try {
+                loadDirect("/etc/OGRE/" + filename, separators, trimWhitespace);
+                return;
+            } catch (...) { /* was just a test */ }
+            // Try /usr/share/OGRE/<file> last
+            try {
+                loadDirect("/usr/share/OGRE/" + filename, separators, trimWhitespace);
+                return;
+            } catch (...) { /* was just a test */ }
+            /* dammit... */
+            throw e;
+        }
     }
+
     //-----------------------------------------------------------------------
     void ConfigFile::load(const String& filename, const String& resourceGroup, 
         const String& separators, bool trimWhitespace)