summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index a64bde6fb4..a06b204da7 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -201,6 +201,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return result;
}
+#ifndef QT_BOOTSTRAPPED
+extern QString qAppFileName();
+#endif
+
QStringList QStandardPaths::standardLocations(StandardLocation type)
{
QStringList dirs;
@@ -217,8 +221,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
dirs.append(programData);
}
#ifndef QT_BOOTSTRAPPED
- dirs.append(QCoreApplication::applicationDirPath());
- dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data"));
+ // Note: QCoreApplication::applicationDirPath(), while static, requires
+ // an application instance. But we might need to resolve the standard
+ // locations earlier than that, so we fall back to qAppFileName().
+ QString applicationDirPath = qApp ? QCoreApplication::applicationDirPath()
+ : QFileInfo(qAppFileName()).path();
+ dirs.append(applicationDirPath);
+ dirs.append(applicationDirPath + QLatin1String("/data"));
#endif // !QT_BOOTSTRAPPED
} // isConfigLocation()