diff options
author | Liang Qi <liang.qi@qt.io> | 2017-11-24 06:42:34 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2017-11-24 06:42:34 +0000 |
commit | fbca13949a28cc3e815b829d814514ab78be6ce1 (patch) | |
tree | e4d33beeef01dbe54c5e7d7dd13c5427ce5b496d /src/corelib/io/qstandardpaths_win.cpp | |
parent | dfa172034e19b6011cc4e7c784b1a5b82996d630 (diff) | |
parent | 7c4b0aa9706bdb79f0f79841cf6704e2f613fe69 (diff) |
Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10
Diffstat (limited to 'src/corelib/io/qstandardpaths_win.cpp')
-rw-r--r-- | src/corelib/io/qstandardpaths_win.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 41fd31df8b..eeb02419c3 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()); - const QString dataDir = 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); + const QString dataDir = applicationDirPath + QLatin1String("/data"); dirs.append(dataDir); if (!isGenericConfigLocation(type)) { |