summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 84efc65f..02335f9b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -317,7 +317,37 @@ int main(int argc, char *argv[])
{
MOApplication application(argc, argv);
- application.addLibraryPath(application.applicationDirPath() + "/dlls");
+ qDebug("application name: %s", qPrintable(application.applicationName()));
+
+ QString instanceID;
+ QFile instanceFile(application.applicationDirPath() + "/INSTANCE");
+ if (instanceFile.open(QIODevice::ReadOnly)) {
+ instanceID = instanceFile.readAll().trimmed();
+ }
+
+ QString dataPath = instanceID.isEmpty() ? application.applicationDirPath()
+ : QDir::fromNativeSeparators(
+#if QT_VERSION >= 0x050000
+ QStandardPaths::writableLocation(QStandardPaths::DataLocation)
+#else
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation)
+#endif
+ ) + "/" + instanceID;
+ application.setProperty("dataPath", dataPath);
+
+#if QT_VERSION >= 0x050000
+ qDebug("ssl support: %d", QSslSocket::supportsSsl());
+#endif
+
+ qDebug("data path: %s", qPrintable(dataPath));
+ if (!QDir(dataPath).exists()) {
+ if (!QDir().mkpath(dataPath)) {
+ qCritical("failed to create %s", qPrintable(dataPath));
+ return 1;
+ }
+ }
+
+ application.setLibraryPaths(QStringList() << (application.applicationDirPath() + "/dlls"));
SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);