MCPcopy Create free account
hub / github.com/Geant4/geant4 / FindDirectory

Method FindDirectory

source/interfaces/core/src/G4VBasicShell.cc:82–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82G4UIcommandTree* G4VBasicShell::FindDirectory(const char* dirName) const
83{
84 G4String theDir = G4StrUtil::strip_copy(dirName);
85
86 G4String targetDir = ModifyPath(theDir);
87 if (targetDir.back() != '/') {
88 targetDir += "/";
89 }
90 G4UIcommandTree* comTree = G4UImanager::GetUIpointer()->GetTree();
91 if (targetDir == "/") {
92 return comTree;
93 }
94 size_t idx = 1;
95 while (idx < targetDir.length() - 1) {
96 size_t i = targetDir.find('/', idx);
97 comTree = comTree->GetTree(targetDir.substr(0, i + 1).c_str());
98 if (comTree == nullptr) {
99 return nullptr;
100 }
101 idx = i + 1;
102 }
103 return comTree;
104}
105
106G4UIcommand* G4VBasicShell::FindCommand(const char* commandName) const
107{

Callers

nothing calls this directly

Calls 6

backMethod · 0.80
c_strMethod · 0.80
substrMethod · 0.80
GetTreeMethod · 0.45
lengthMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected