Changeset View
Changeset View
Standalone View
Standalone View
source/scriptinterface/ScriptInterface.cpp
Show First 20 Lines • Show All 459 Lines • ▼ Show 20 Lines | |||||
bool ScriptInterface::LoadGlobalScripts() | bool ScriptInterface::LoadGlobalScripts() | ||||
{ | { | ||||
// Ignore this failure in tests | // Ignore this failure in tests | ||||
if (!g_VFS) | if (!g_VFS) | ||||
return false; | return false; | ||||
// Load and execute *.js in the global scripts directory | // Load and execute *.js in the global scripts directory | ||||
// Sort them, so that modders can extend code from previously loaded files. | |||||
VfsPaths pathnames; | VfsPaths pathnames; | ||||
vfs::GetPathnames(g_VFS, L"globalscripts/", L"*.js", pathnames); | vfs::GetPathnames(g_VFS, L"globalscripts/", L"*.js", pathnames, true); | ||||
for (const VfsPath& path : pathnames) | for (const VfsPath& path : pathnames) | ||||
if (!LoadGlobalScriptFile(path)) | if (!LoadGlobalScriptFile(path)) | ||||
{ | { | ||||
LOGERROR("LoadGlobalScripts: Failed to load script %s", path.string8()); | LOGERROR("LoadGlobalScripts: Failed to load script %s", path.string8()); | ||||
return false; | return false; | ||||
} | } | ||||
JSAutoRequest rq(m->m_cx); | JSAutoRequest rq(m->m_cx); | ||||
▲ Show 20 Lines • Show All 675 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator