MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / reloadScripts

Method reloadScripts

plugins/script/ScriptingSystem.cpp:176–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void ScriptingSystem::reloadScripts()
177{
178 // Release all previously allocated commands
179 _commands.clear();
180
181 // Initialise the search's starting point
182 fs::path start = fs::path(_scriptPath) / COMMAND_PATH;
183
184 if (!fs::exists(start))
185 {
186 rWarning() << "Couldn't find scripts folder: " << start.string() << std::endl;
187 return;
188 }
189
190 for (fs::recursive_directory_iterator it(start);
191 it != fs::recursive_directory_iterator(); ++it)
192 {
193 // Get the candidate
194 const fs::path& candidate = *it;
195
196 if (fs::is_directory(candidate)) continue;
197
198 std::string extension = os::getExtension(candidate.string());
199 string::to_lower(extension);
200
201 if (extension != PYTHON_FILE_EXTENSION) continue;
202
203 // Script file found, construct a new command
204 loadCommandScript(os::getRelativePath(candidate.generic_string(), _scriptPath));
205 }
206
207 rMessage() << "ScriptModule: Found " << _commands.size() << " commands." << std::endl;
208
209 _sigScriptsReloaded.emit();
210}
211
212// RegisterableModule implementation
213const std::string& ScriptingSystem::getName() const

Callers

nothing calls this directly

Calls 8

rWarningFunction · 0.85
getExtensionFunction · 0.85
to_lowerFunction · 0.85
getRelativePathFunction · 0.85
rMessageFunction · 0.85
stringMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected