diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-08-04 08:22:00 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-08-04 08:35:41 (GMT) |
commit | 4eaf761eba1ed0e9980ce5758a40c17e41510ee2 (patch) | |
tree | 5994904d585cc9caf50e42a7930815c78d517e6d | |
parent | f47200c7eb91c3709f88647c9472786038f15478 (diff) | |
download | Qt-4eaf761eba1ed0e9980ce5758a40c17e41510ee2.zip Qt-4eaf761eba1ed0e9980ce5758a40c17e41510ee2.tar.gz Qt-4eaf761eba1ed0e9980ce5758a40c17e41510ee2.tar.bz2 |
Fix package header in cases where VERSION doesn't contain all values
Missing minor or patch value from VERSION caused malformed pkg header
to be generated.
Task-number: QTBUG-12617
Reviewed-by: axis
-rw-r--r-- | qmake/generators/symbian/symbiancommon.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 3a4bdbc..d124b02 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -252,8 +252,30 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB tw << languageRules.join("\n") << endl; ts << languageRules.join("\n") << endl; - // name of application, UID and version - QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); + // Determine application version. If version has missing component values, + // those will default to zero. + // If VERSION is missing altogether or is invalid, use "1,0,0" + QStringList verNumList = project->first("VERSION").split('.'); + uint major = 0; + uint minor = 0; + uint patch = 0; + bool success = false; + + if (verNumList.size() > 0) { + major = verNumList[0].toUInt(&success); + if (success && verNumList.size() > 1) { + minor = verNumList[1].toUInt(&success); + if (success && verNumList.size() > 2) { + patch = verNumList[2].toUInt(&success); + } + } + } + + QString applicationVersion("1,0,0"); + if (success) + applicationVersion = QString("%1,%2,%3").arg(major).arg(minor).arg(patch); + + // Package header QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n"; QString visualTarget = generator->escapeFilePath(project->first("TARGET")); |