summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-30 12:57:22 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-11-30 12:57:22 +0000
commitc35342ffeba10deecb2d8c0ce30a3a1a4ec1ee8d (patch)
tree0b7782b3d8973d20ee4db36f768367b94e3d3394 /src/corelib/io
parent7200572b393534a2f503b810180276d2ae809c7a (diff)
parent87204c856ae3d8495c41af998ac196a12fe1c779 (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qloggingregistry.cpp3
-rw-r--r--src/corelib/io/qloggingregistry_p.h2
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp13
4 files changed, 15 insertions, 5 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 0a3e83206b..7d46898911 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1879,7 +1879,7 @@ QByteArray QIODevice::peek(qint64 maxSize)
}
/*!
- \since 5.11
+ \since 5.10
Skips up to \a maxSize bytes from the device. Returns the number of bytes
actually skipped, or -1 on error.
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 0e7eaeea76..1bf61017f6 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -255,6 +255,7 @@ void QLoggingSettingsParser::parseNextLine(QStringRef line)
QLoggingRegistry::QLoggingRegistry()
: categoryFilter(defaultCategoryFilter)
{
+ initalizeRules(); // Init on first use
}
static bool qtLoggingDebug()
@@ -283,7 +284,7 @@ static QVector<QLoggingRule> loadRulesFromFile(const QString &filePath)
Initializes the rules database by loading
$QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini.
*/
-void QLoggingRegistry::init()
+void QLoggingRegistry::initalizeRules()
{
QVector<QLoggingRule> er, qr, cr;
// get rules from environment
diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index a68b993cca..a3857d3588 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -113,7 +113,7 @@ class Q_AUTOTEST_EXPORT QLoggingRegistry
public:
QLoggingRegistry();
- void init();
+ void initalizeRules();
void registerCategory(QLoggingCategory *category, QtMsgType enableForLevel);
void unregisterCategory(QLoggingCategory *category);
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)) {