diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx index ceabee8d46b4c9034b96e1390d7021cbac64664c..4ae5f6aa596ce7f8e779f63fc6189e8ebb7d7a10 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx @@ -628,6 +628,21 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() } } } + + // Check output paths validity + if (hasValue) + { + if (type == ParameterType_OutputFilename) + { + std::string filename = m_Application->GetParameterString(paramKey); + itksys::String path = itksys::SystemTools::GetFilenamePath(filename); + if (!itksys::SystemTools::FileIsDirectory(path.c_str())) + { + std::cerr <<"ERROR: Directory doesn't exist : "<< path.c_str() << std::endl; + return WRONGPARAMETERVALUE; + } + } + } } return OKPARAM;