| 338 | } |
| 339 | |
| 340 | ExitCodes main_(int, const char **) override |
| 341 | { |
| 342 | // find the config for the tool: |
| 343 | String type = getStringOption_("type"); |
| 344 | |
| 345 | |
| 346 | Param tool_param = this->getParam_(); |
| 347 | |
| 348 | // check required parameters (TOPPBase does not do this as we did not use registerInputFile_(...) etc) |
| 349 | Param p = tool_param.copy("ETool:", true); |
| 350 | for (Param::ParamIterator it = p.begin(); it != p.end(); ++it) |
| 351 | { |
| 352 | if ((it->tags).count("required") > 0) |
| 353 | { |
| 354 | String in = String(it->value.toString()).trim(); // will give '[]' for empty lists (hack, but DataValue class does not offer a convenient query) |
| 355 | if (in.empty() || in == "[]") // any required parameter should have a value |
| 356 | { |
| 357 | OPENMS_LOG_ERROR << "The INI-parameter 'ETool:" << it->name << "' is required, but was not given! Aborting ..." << std::endl; |
| 358 | return wrapExit(CANNOT_WRITE_OUTPUT_FILE); |
| 359 | } |
| 360 | else if ((it->tags).count("input file") > 0) // any required input file should exist |
| 361 | { |
| 362 | StringList ifs; |
| 363 | switch (it->value.valueType()) |
| 364 | { |
| 365 | case ParamValue::STRING_VALUE: |
| 366 | ifs.push_back(it->value.toChar()); |
| 367 | break; |
| 368 | case ParamValue::STRING_LIST: |
| 369 | ifs = ListUtils::toStringList<std::string>(it->value); |
| 370 | break; |
| 371 | default: |
| 372 | OPENMS_LOG_ERROR << "The INI-parameter 'ETool:" << it->name << "' is tagged as input file and thus must be a string! Aborting ..."; |
| 373 | return wrapExit(ILLEGAL_PARAMETERS); |
| 374 | } |
| 375 | for (StringList::const_iterator itf = ifs.begin(); itf != ifs.end(); ++itf) |
| 376 | { |
| 377 | if (!File::exists(*itf)) |
| 378 | { |
| 379 | OPENMS_LOG_ERROR << "Input file '" << *itf << "' does not exist! Aborting ..."; |
| 380 | return wrapExit(INPUT_FILE_NOT_FOUND); |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | Internal::ToolDescription gw = ToolHandler::getTOPPToolList(true)[toolName_()]; |
| 388 | for (Size i = 0; i < gw.types.size(); ++i) |
| 389 | { |
| 390 | if (type == gw.types[i]) |
| 391 | { |
| 392 | tde_ = gw.external_details[i]; |
| 393 | if (tde_.working_directory.trim().empty()) |
| 394 | { |
| 395 | tde_.working_directory = "."; |
| 396 | } |
| 397 | break; |
nothing calls this directly
no test coverage detected