diff options
author | Katja Marttila <[email protected]> | 2025-06-05 12:55:26 +0300 |
---|---|---|
committer | Katja Marttila <[email protected]> | 2025-06-06 06:18:08 +0000 |
commit | 2372b336f731520141f53f21b662967603905659 (patch) | |
tree | b10aa6744e7c97e0a7c045ada56e38bd7efc6266 /src | |
parent | 1e033dde76b1ef17d71d318a98411dba0aaf3610 (diff) |
Variables can be defined inside '@' symbols, and are resolved by
runtime, like @HomeDir@. This enables the usage of the correct variable
value before its final set.
If the variable inside '@' was not an installer value, installer
replaced the variable with empty value. As the double '@' can be also
part of the value itself, installer should not replace it with empty
value if no real variable is found for it.
Task-number: QTIFW-2945
Change-Id: I83ca40db1e03a12ba51535766b054765071d09ad
Reviewed-by: Arttu Tarkiainen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/packagemanagercoredata.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp index 1113908bd..3249842aa 100644 --- a/src/libs/installer/packagemanagercoredata.cpp +++ b/src/libs/installer/packagemanagercoredata.cpp @@ -287,7 +287,10 @@ QString PackageManagerCoreData::replaceVariables(const QString &str) const break; res += str.mid(pos, pos1 - pos); const QString name = str.mid(pos1 + 1, pos2 - pos1 - 1); - res += value(name).toString(); + const QString &strValue = value(name).toString(); + if (strValue.isEmpty()) + return str; + res += strValue; pos = pos2 + 1; } res += str.mid(pos); @@ -308,7 +311,11 @@ QByteArray PackageManagerCoreData::replaceVariables(const QByteArray &ba) const break; res += ba.mid(pos, pos1 - pos); const QString name = QString::fromLocal8Bit(ba.mid(pos1 + 1, pos2 - pos1 - 1)); - res += value(name).toString().toLocal8Bit(); + + const QString &baValue = value(name).toString(); + if (baValue.isEmpty()) + return ba; + res += baValue.toLocal8Bit(); pos = pos2 + 1; } res += ba.mid(pos); |