diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2011-12-15 13:28:30 +0100 |
---|---|---|
committer | Alexander Lenhardt <alexander.lenhardt@nokia.com> | 2011-12-15 14:30:59 +0100 |
commit | ab02e01224111725def138db1c2d5b4daabbbf3a (patch) | |
tree | 4c7c8af99f5d0dd145b390d8e52691f808a54c9f | |
parent | 75fcb2cbc0ad54d91e446150f10954a294d90bfe (diff) |
improve parse arguments at operationrunner
- and don't pollute args with this cleanlooks hack
Change-Id: I6cacd33b5c02effe267fabc745b1e8f1aab77166
Reviewed-by: Alexander Lenhardt <alexander.lenhardt@nokia.com>
-rw-r--r-- | installerbuilder/installerbase/installerbase.cpp | 3 | ||||
-rw-r--r-- | installerbuilder/libinstaller/operationrunner.cpp | 17 |
2 files changed, 12 insertions, 8 deletions
diff --git a/installerbuilder/installerbase/installerbase.cpp b/installerbuilder/installerbase/installerbase.cpp index 9cb542c43..50479f298 100644 --- a/installerbuilder/installerbase/installerbase.cpp +++ b/installerbuilder/installerbase/installerbase.cpp @@ -88,6 +88,8 @@ static QSet<Repository> repositories(const QStringList &arguments, const int ind int main(int argc, char *argv[]) { + QStringList args = QInstaller::parseCommandLineArgs(argc, argv); + // hack to use cleanlooks if it is under Ubuntu 11.10 #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) std::string standardString; @@ -118,7 +120,6 @@ int main(int argc, char *argv[]) const KDSelfRestarter restarter(argc, argv); KDRunOnceChecker runCheck(QLatin1String("lockmyApp1234865.lock")); - QStringList args = QInstaller::parseCommandLineArgs(argc, argv); try { if (args.contains(QLatin1String("--version"))) { InstallerBase::showVersion(QLatin1String(VERSION)); diff --git a/installerbuilder/libinstaller/operationrunner.cpp b/installerbuilder/libinstaller/operationrunner.cpp index fc8a11fd0..e4d6ec5d0 100644 --- a/installerbuilder/libinstaller/operationrunner.cpp +++ b/installerbuilder/libinstaller/operationrunner.cpp @@ -99,19 +99,22 @@ int OperationRunner::runOperation(const QStringList &arguments) << "are working as expected." << std::endl; } - QStringList argumentList = arguments; - bool isPerformType = argumentList.contains(QLatin1String("--runoperation")); - bool isUndoType = argumentList.contains(QLatin1String("--undooperation")); - argumentList.removeFirst(); //the application name itself - argumentList.removeAll(QLatin1String("--runoperation")); - argumentList.removeAll(QLatin1String("--undooperation")); - argumentList.removeAll(QLatin1String("--verbose")); + bool isPerformType = arguments.contains(QLatin1String("--runoperation")); + bool isUndoType = arguments.contains(QLatin1String("--undooperation")); if ((!isPerformType && !isUndoType) || (isPerformType && isUndoType)) { std::cerr << "wrong arguments are used, cannot run this operation"; return EXIT_FAILURE; } + QStringList argumentList; + + if (isPerformType) + argumentList = arguments.mid(testStringList.indexOf("--runoperation") + 1); + else + argumentList = arguments.mid(testStringList.indexOf("--undooperation") + 1); + + try { const QString operationName = argumentList.takeFirst(); KDUpdater::UpdateOperation* const operation = KDUpdater::UpdateOperationFactory::instance() |