| 148 | } |
| 149 | |
| 150 | void ScriptingSystem::loadCommandScript(const std::string& scriptFilename) |
| 151 | { |
| 152 | auto command = _pythonModule->createScriptCommand(_scriptPath, scriptFilename); |
| 153 | |
| 154 | if (!command) |
| 155 | { |
| 156 | // The python module already emitted some errors to the log, just exit |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | // Try to register this named command |
| 161 | auto result = _commands.emplace(command->getName(), command); |
| 162 | |
| 163 | // Result.second is TRUE if the insert succeeded |
| 164 | if (result.second) |
| 165 | { |
| 166 | rMessage() << "Registered script file " << scriptFilename << " as " << command->getName() << std::endl; |
| 167 | } |
| 168 | else |
| 169 | { |
| 170 | rError() << "Error in " << scriptFilename << ": Script command " |
| 171 | << command->getName() << " has already been registered in " |
| 172 | << _commands[command->getName()]->getFilename() << std::endl; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | void ScriptingSystem::reloadScripts() |
| 177 | { |
nothing calls this directly
no test coverage detected