diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx index 1a5ae9349f27afcdab7d1597382c75f433504aac..fcc6d9deabd1c525d96d0bf27fbf7c803f0fbdfa 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx @@ -92,12 +92,6 @@ void CommandLineLauncher::DeleteWatcherList() bool CommandLineLauncher::Load(const std::string & exp) { m_Expression = exp; - //std::cout<<m_Expression<<std::endl; - - while(m_Expression.find(" ") != std::string::npos) - m_Expression.erase(m_Expression.find(" "), 1); - - //std::cout<<m_Expression<<std::endl; return this->Load(); } @@ -131,12 +125,6 @@ bool CommandLineLauncher::Load() << "\" is invalid or doesn't exist..." << std::endl; return false; } -/* - else - { - std::cerr << "ERROR: Trouble loading path, please check your command line..." << std::endl; - } -*/ } this->LoadApplication(); @@ -209,7 +197,6 @@ bool CommandLineLauncher::BeforeExecute() this->LoadTestEnv(); } - // Check the key validity (ie. exist in the application parameters) if (this->CheckKeyValidity() == false) { @@ -217,7 +204,6 @@ bool CommandLineLauncher::BeforeExecute() this->DisplayHelp(); return false; } - try { if (this->LoadParameters() != OKPARAM) @@ -268,6 +254,7 @@ bool CommandLineLauncher::BeforeExecute() // Force to reload the application, the LoadParameters can change wrong values this->LoadApplication(); this->DisplayHelp(); + return false; } } @@ -348,7 +335,6 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() } const std::vector<std::string> appKeyList = m_Application->GetParametersKeys(true); - // Loop over each parameter key declared in the application for (unsigned int i = 0; i < appKeyList.size(); i++) { @@ -359,13 +345,11 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() const bool paramExists(m_Parser->IsAttributExists(std::string("-").append(paramKey), m_Expression)); - // if param is a Group, dont do anything, ParamGroup dont have values if (type != ParameterType_Group) { // Get the attribute relative to this key as vector values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_Expression); - // If the param does not exists in the cli, dont try to set a // value on it, an exception will be thrown later in this function @@ -487,7 +471,7 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() m_Application->UpdateParameters(); } } - + // Check if mandatory parameter are present and have value // A param has to be set if it is mandatory and : // is root OR its parent is active @@ -562,7 +546,6 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() } } - return OKPARAM; } diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx index 3ff0c8cdd32d593f9678bb71f402595adc5a2f89..dd38c1df81fc8c1dde304286d7bdfe30bc79a06c 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx @@ -175,14 +175,12 @@ CommandLineParser::GetAttribut( const std::string & key, const std::string & exp { return res; } - std::string expFromKey = std::string(exp).substr(found+key.size()+1, std::string(exp).size()); if( expFromKey.size() == 0 ) { return res; } - std::string tempModKey = expFromKey; // remove other key in the string if there's any bool stop = false; @@ -246,7 +244,7 @@ CommandLineParser::GetAttribut( const std::string & key, const std::string & exp { while( spaceSplitted[i].size()>0 && spaceSplitted[i][0] == ' ' ) { - spaceSplitted[i] = spaceSplitted[i].substr(0, spaceSplitted[i].size()); + spaceSplitted[i] = spaceSplitted[i].substr(1, spaceSplitted[i].size()); } res.push_back(spaceSplitted[i]);