From b8e89d32fb35298ad1155773b854dd6b4fee9163 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Mon, 1 Sep 2014 12:02:18 +0200 Subject: [PATCH] BUG: Mantis #968: only check mandatory parameters after all values have been set --- .../CommandLine/otbWrapperCommandLineLauncher.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx index ecac446dd8..ceabee8d46 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx @@ -386,6 +386,7 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() const std::vector<std::string> appKeyList = m_Application->GetParametersKeys(true); // Loop over each parameter key declared in the application + // FIRST PASS : set parameter values for (unsigned int i = 0; i < appKeyList.size(); i++) { const std::string paramKey(appKeyList[i]); @@ -540,6 +541,16 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() m_Application->UpdateParameters(); } } + } + + // SECOND PASS : check mandatory parameters + for (unsigned int i = 0; i < appKeyList.size(); i++) + { + const std::string paramKey(appKeyList[i]); + Parameter::Pointer param = m_Application->GetParameterByKey(paramKey); + ParameterType type = m_Application->GetParameterType(paramKey); + const bool paramExists(m_Parser->IsAttributExists(std::string("-").append(paramKey), m_VExpression)); + std::vector<std::string> values; // When a parameter is mandatory : // it must be set if : -- GitLab