| 80 | } |
| 81 | |
| 82 | G4UIcommandTree* 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 | |
| 106 | G4UIcommand* G4VBasicShell::FindCommand(const char* commandName) const |
| 107 | { |