MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / scriptsLoadFolder

Method scriptsLoadFolder

Source/ScriptingEngine.cpp:420–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420bool cScriptingEngine::scriptsLoadFolder(const std::string& pFolder) {
421
422 auto finalpath = g_ResourceMan->GetScriptPath(pFolder);
423 auto scripts = g_ResourceMan->DirectoryList(finalpath, "js");
424
425 for (auto scriptFile : scripts) {
426
427 auto finalName = pFolder + scriptFile;
428 auto script = g_ResourceMan->FileReadStr(finalpath + scriptFile);
429
430 if (!script.size() || (scriptRun(script, finalName) == false)) {
431 g_Debugger->Error(finalpath + scriptFile + " Failed to execute script:" + scriptFile);
432 return false;
433 }
434 }
435
436 return true;
437}
438
439bool cScriptingEngine::scriptRun(const std::string& pJS, const std::string& pFilename) {
440 int success = DUK_EXEC_ERROR;

Callers

nothing calls this directly

Calls 5

GetScriptPathMethod · 0.80
DirectoryListMethod · 0.80
FileReadStrMethod · 0.80
ErrorMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected