comparison base/ResourceFinder.cpp @ 1247:8f076d02569a piper

Make SVDEBUG always write to a log file -- formerly this was disabled in NDEBUG builds. I think there's little use to that, it just means that we keep adding more cerr debug output because we aren't getting the log we need. And SVDEBUG logging is not usually used in tight loops, I don't think the performance overhead is too serious. Also update the About box.
author Chris Cannam
date Thu, 03 Nov 2016 14:57:00 +0000
parents a8f91db36e9d
children e1926cba940c
comparison
equal deleted inserted replaced
1246:75aefcc9f07d 1247:8f076d02569a
31 #include <QStandardPaths> 31 #include <QStandardPaths>
32 #endif 32 #endif
33 33
34 #include <cstdlib> 34 #include <cstdlib>
35 #include <iostream> 35 #include <iostream>
36 #include <stdexcept>
36 37
37 /** 38 /**
38 Resource files may be found in three places: 39 Resource files may be found in three places:
39 40
40 * Bundled into the application as Qt4 resources. These may be 41 * Bundled into the application as Qt4 resources. These may be
124 } 125 }
125 126
126 static QString 127 static QString
127 getNewStyleUserResourcePrefix() 128 getNewStyleUserResourcePrefix()
128 { 129 {
130 if (qApp->applicationName() == "") {
131 cerr << "ERROR: Can't use ResourceFinder before setting application name" << endl;
132 throw std::logic_error("Can't use ResourceFinder before setting application name");
133 }
134
129 #if QT_VERSION >= 0x050000 135 #if QT_VERSION >= 0x050000
130 // This is expected to be much more reliable than 136 // This is expected to be much more reliable than
131 // getOldStyleUserResourcePrefix(), but it returns a different 137 // getOldStyleUserResourcePrefix(), but it returns a different
132 // directory because it includes the organisation name (which is 138 // directory because it includes the organisation name (which is
133 // fair enough). Hence migrateOldStyleResources() which moves 139 // fair enough). Hence migrateOldStyleResources() which moves
134 // across any resources found in the old-style path the first time 140 // across any resources found in the old-style path the first time
135 // we look for the new-style one 141 // we look for the new-style one
136 return QStandardPaths::writableLocation(QStandardPaths::DataLocation); 142 return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
137 #else 143 #else
138 return getOldStyleUserResourcePrefix(); 144 return getOldStyleUserResourcePrefix();
139 #endif 145 #endif
140 } 146 }
141 147