Mercurial > hg > svcore
diff base/ResourceFinder.cpp @ 1251:67aee57e32c8 3.0-integration
Merge from branch piper
author | Chris Cannam |
---|---|
date | Fri, 04 Nov 2016 14:57:03 +0000 |
parents | 8f076d02569a |
children | e1926cba940c |
line wrap: on
line diff
--- a/base/ResourceFinder.cpp Tue Nov 01 14:06:47 2016 +0000 +++ b/base/ResourceFinder.cpp Fri Nov 04 14:57:03 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