changeset 1398:e1926cba940c

Support pre-5.4 Qt builds. Also, don't use SVDEBUG in here, because it depends on this class!
author Chris Cannam
date Mon, 06 Mar 2017 09:34:09 +0000
parents b0533d195c83
children 08bbbd2023c4
files base/ResourceFinder.cpp
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/base/ResourceFinder.cpp	Sun Mar 05 21:51:10 2017 +0000
+++ b/base/ResourceFinder.cpp	Mon Mar 06 09:34:09 2017 +0000
@@ -133,14 +133,22 @@
     }
 
 #if QT_VERSION >= 0x050000
+
     // This is expected to be much more reliable than
     // getOldStyleUserResourcePrefix(), but it returns a different
     // directory because it includes the organisation name (which is
     // fair enough). Hence migrateOldStyleResources() which moves
     // across any resources found in the old-style path the first time
     // we look for the new-style one
+#if QT_VERSION >= 0x050400
     return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
 #else
+    cerr << "WARNING: ResourceFinder::getOldStyleUserResourcePrefix: Building with older version of Qt (pre 5.4), resource location may be incompatible with future versions" << endl;
+    return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+#endif
+    
+#else
+    cerr << "WARNING: ResourceFinder::getOldStyleUserResourcePrefix: Building with very old version of Qt (pre 5.0?), resource location may be incompatible with future versions" << endl;
     return getOldStyleUserResourcePrefix();
 #endif
 }
@@ -239,12 +247,12 @@
         
         QString prefix = *i;
 
-        SVDEBUG << "ResourceFinder::getResourcePath: Looking up file \"" << fileName << "\" for category \"" << resourceCat << "\" in prefix \"" << prefix << "\"" << endl;
+//        cerr << "ResourceFinder::getResourcePath: Looking up file \"" << fileName << "\" for category \"" << resourceCat << "\" in prefix \"" << prefix << "\"" << endl;
 
         QString path =
             QString("%1%2/%3").arg(prefix).arg(resourceCat).arg(fileName);
         if (QFileInfo(path).exists() && QFileInfo(path).isReadable()) {
-            cerr << "Found it!" << endl;
+//            cerr << "Found it!" << endl;
             return path;
         }
     }