MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / find

Method find

src/openms/source/SYSTEM/File.cpp:371–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369 }
370
371 String File::find(const String& filename, StringList directories)
372 {
373 // maybe we do not need to do anything?!
374 // This check is required since calling File::find(File::find("CHEMISTRY/unimod.xml")) will otherwise fail
375 // because the outer call receives an absolute path already
376 if (exists(filename))
377 {
378 return filename;
379 }
380 String filename_new = filename;
381
382 // empty string cannot be found, so throw Exception.
383 // The code below would return success on empty string, since a path is prepended and thus the location exists
384 if (filename_new.trim().empty())
385 {
386 throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename);
387 }
388 //add data dir in OpenMS data path
389 directories.push_back(getOpenMSDataPath());
390
391 //add path suffix to all specified directories
392 String path = File::path(filename);
393 if (!path.empty())
394 {
395 for (String& str : directories)
396 {
397 str.ensureLastChar('/');
398 str += path;
399 }
400 filename_new = File::basename(filename);
401 }
402
403 //look up file
404 for (const String& str : directories)
405 {
406 String loc = str;
407 loc.ensureLastChar('/');
408 loc = loc + filename_new;
409
410 if (exists(loc))
411 {
412 return String(QDir::cleanPath(loc.toQString()));
413 }
414 }
415
416 //if the file was not found, throw an exception
417 throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename);
418 }
419
420 bool File::fileList(const String& dir, const String& file_pattern, StringList& output, bool full_path)
421 {

Callers 15

handle_member_definitionFunction · 0.45
get_pxd_from_classMethod · 0.45
compute_importsMethod · 0.45
checkPythonPxdHeaderFunction · 0.45
convertMethod · 0.45
getDriftTimeArrayFunction · 0.45
loadMethod · 0.45
addTransitionAsLayerFunction · 0.45
updateProteinEntries_Method · 0.45
saveIDs_Method · 0.45
foreachFunction · 0.45

Calls 4

StringClass · 0.50
emptyMethod · 0.45
push_backMethod · 0.45
toQStringMethod · 0.45

Tested by 15

updateProteinEntries_Method · 0.36
saveIDs_Method · 0.36
updateEntriesMethod · 0.36
main_Method · 0.36
searchSpectrumMethod · 0.36
selectSpectraMethod · 0.36
toSpectrumMethod · 0.36
operator()Method · 0.36
dynprog_Method · 0.36
handlePTMsMethod · 0.36
loadMethod · 0.36
getACAndACTypeMethod · 0.36