diff options
| author | Tannin <devnull@localhost> | 2014-11-21 15:01:47 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-11-21 15:01:47 +0100 |
| commit | cfb863f6c3ae7406028b9e167a3115250fefbca3 (patch) | |
| tree | fd7c5a85835098ba26f277c015cf10d289335112 /src | |
| parent | f481a7aae31c9f79e115d9e32aefbc304a41e881 (diff) | |
qt5 compatibility
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index a21f41e4..4dbf9ff9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -308,10 +308,17 @@ int main(int argc, char *argv[]) QFile instanceFile(application.applicationDirPath() + "/INSTANCE");
if (instanceFile.open(QIODevice::ReadOnly)) {
instanceID = instanceFile.readAll().trimmed();
- }
+ }
- QString dataPath = instanceID.isEmpty() ? application.applicationDirPath()
- : QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::DataLocation)) + "/" + instanceID;
+ QString dataPath =
+ instanceID.isEmpty() ? application.applicationDirPath()
+ : QDir::fromNativeSeparators(
+#if QT_VERSION >= 0x050000
+ QStandardPaths::writableLocation(QStandardPaths::DataLocation)
+#else
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation)
+#endif
+ );
application.setProperty("dataPath", dataPath);
qDebug("data path: %s", qPrintable(dataPath));
|
