Mercurial > hg > svcore
diff base/ResourceFinder.cpp @ 982:f161ca450050
Use QStandardPaths::writableLocation(DataLocation) instead of synthesising path ourselves (hopefully fixing encoding difficulties on Windows)
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 20:37:07 +0100 |
parents | 9a422d610058 |
children | a8f91db36e9d |
line wrap: on
line diff
--- a/base/ResourceFinder.cpp Tue Sep 09 16:52:24 2014 +0100 +++ b/base/ResourceFinder.cpp Tue Sep 09 20:37:07 2014 +0100 @@ -27,6 +27,10 @@ #include <QProcess> #include <QCoreApplication> +#if QT_VERSION >= 0x050000 +#include <QStandardPaths> +#endif + #include <cstdlib> #include <iostream> @@ -91,7 +95,12 @@ QString ResourceFinder::getUserResourcePrefix() { +#if QT_VERSION >= 0x050000 + QString loc = QStandardPaths::writableLocation(QStandardPaths::DataLocation); + return loc; +#else #ifdef Q_OS_WIN32 + // This does not work correctly for non-ASCII home directory names char *homedrive = getenv("HOMEDRIVE"); char *homepath = getenv("HOMEPATH"); QString home; @@ -114,7 +123,8 @@ .arg(home) .arg(qApp->applicationName()); #endif -#endif +#endif +#endif } QStringList