QLoggingRegistry: remove use of QDir and merge two strings
We don't need to apply QDir::absolutePath() on the diretory that QLibraryInfo::path() returns, because that is already an absolute path (and if it weren't, it wouldn't make a difference anyway). That means we are only doing path concatenation here. For code this low-level, it's better to stick to QString. This commit also rejiggles the string variables so we avoid one of the memory allocations when calling QStandardPaths. Change-Id: Ic3405877155a15ac4ac6fffdc92463ae0bff0bd9 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit e0cdcf66cad739af808ae952c125030e9ad52de4)
This commit is contained in:
parent
79e3416bb0
commit
31334da21e
@ -301,16 +301,16 @@ void QLoggingRegistry::initializeRules()
|
||||
er += parser.rules();
|
||||
}
|
||||
|
||||
const QString configFileName = QStringLiteral("qtlogging.ini");
|
||||
const QString configFileName = u"QtProject/qtlogging.ini"_s;
|
||||
QStringView baseConfigFileName = QStringView(configFileName).sliced(strlen("QtProject"));
|
||||
Q_ASSERT(baseConfigFileName.startsWith(u'/'));
|
||||
|
||||
// get rules from Qt data configuration path
|
||||
const QString qtConfigPath
|
||||
= QDir(QLibraryInfo::path(QLibraryInfo::DataPath)).absoluteFilePath(configFileName);
|
||||
qr = loadRulesFromFile(qtConfigPath);
|
||||
qr = loadRulesFromFile(QLibraryInfo::path(QLibraryInfo::DataPath) + baseConfigFileName);
|
||||
|
||||
// get rules from user's/system configuration
|
||||
const QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation,
|
||||
QString::fromLatin1("QtProject/") + configFileName);
|
||||
configFileName);
|
||||
if (!envPath.isEmpty())
|
||||
cr = loadRulesFromFile(envPath);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user