Mercurial > hg > svcore
diff 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 |
line wrap: on
line diff
--- a/base/ResourceFinder.cpp Thu Nov 03 14:14:09 2016 +0000 +++ b/base/ResourceFinder.cpp Thu Nov 03 14:57:00 2016 +0000 @@ -33,6 +33,7 @@ #include <cstdlib> #include <iostream> +#include <stdexcept> /** Resource files may be found in three places: @@ -126,6 +127,11 @@ static QString getNewStyleUserResourcePrefix() { + if (qApp->applicationName() == "") { + cerr << "ERROR: Can't use ResourceFinder before setting application name" << endl; + throw std::logic_error("Can't use ResourceFinder before setting application name"); + } + #if QT_VERSION >= 0x050000 // This is expected to be much more reliable than // getOldStyleUserResourcePrefix(), but it returns a different @@ -133,7 +139,7 @@ // 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 - return QStandardPaths::writableLocation(QStandardPaths::DataLocation); + return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); #else return getOldStyleUserResourcePrefix(); #endif