diff options
author | Robert Griebl <robert.griebl@qt.io> | 2019-10-18 23:56:08 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2019-10-30 18:15:01 +0100 |
commit | fb8ed4ec6c699187def011d2fccd52e874997de4 (patch) | |
tree | 5b1327d27eb8652042b3f957c1561100c9dd623f /src/launcher-lib/launchermain.cpp | |
parent | 7615be82ab1adea8378b6b934b7fc50e59e20130 (diff) |
Rewrite of the YAML parser abstraction for Qt
The base is still libyaml, but we are using the low-level parse/event API to
speed up parsing. In addition to the old YAML-to-QVariantMap and QVariantMap-
to-YAML APIs, the new parser interface makes it possible easily write a
validating parser: the new YamlParser class.
Change-Id: Ib2130509a3a2675142ce43c8ef125cf48cfd8fea
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Diffstat (limited to 'src/launcher-lib/launchermain.cpp')
-rw-r--r-- | src/launcher-lib/launchermain.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/launcher-lib/launchermain.cpp b/src/launcher-lib/launchermain.cpp index c5147925..6c54a288 100644 --- a/src/launcher-lib/launchermain.cpp +++ b/src/launcher-lib/launchermain.cpp @@ -193,10 +193,15 @@ void LauncherMain::setApplicationId(const QString &applicationId) void LauncherMain::loadConfiguration(const QByteArray &configYaml) Q_DECL_NOEXCEPT_EXPR(false) { - auto docs = QtYaml::variantDocumentsFromYaml(configYaml.isEmpty() ? qgetenv("AM_CONFIG") - : configYaml); - if (docs.size() == 1) - m_configuration = docs.first().toMap(); + try { + QVector<QVariant> docs = YamlParser::parseAllDocuments(configYaml.isEmpty() ? qgetenv("AM_CONFIG") + : configYaml); + if (docs.size() == 1) + m_configuration = docs.first().toMap(); + } catch (const Exception &e) { + throw Exception("Runtime launcher could not parse the YAML configuration coming from the " + "application-manager: %1").arg(e.errorString()); + } m_baseDir = m_configuration.value(qSL("baseDir")).toString() + qL1C('/'); m_runtimeConfiguration = m_configuration.value(qSL("runtimeConfiguration")).toMap(); |