forked from rosebudai/OpenRCT2-Web
Exclude node_modules directory
This commit is contained in:
1 parent
f9d7237e92
commit
2e62078c30
2 files changed
+19
-9
No files matched your search
@@ -86,16 +86,19 @@ void ScriptEngine::LoadPlugins()
|
||||
while (scanner->Next())
|
||||
{
|
||||
auto path = std::string(scanner->GetPath());
|
||||
try
|
||||
if (ShouldLoadScript(path))
|
||||
{
|
||||
auto plugin = std::make_shared<Plugin>(_context, path);
|
||||
ScriptExecutionInfo::PluginScope scope(_execInfo, plugin);
|
||||
plugin->Load();
|
||||
_plugins.push_back(std::move(plugin));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
_console.WriteLineError(e.what());
|
||||
try
|
||||
{
|
||||
auto plugin = std::make_shared<Plugin>(_context, path);
|
||||
ScriptExecutionInfo::PluginScope scope(_execInfo, plugin);
|
||||
plugin->Load();
|
||||
_plugins.push_back(std::move(plugin));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
_console.WriteLineError(e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +117,12 @@ void ScriptEngine::LoadPlugins()
|
||||
}
|
||||
}
|
||||
|
||||
bool ScriptEngine::ShouldLoadScript(const std::string& path)
|
||||
{
|
||||
// A lot of JavaScript is often found in a node_modules directory tree and is most likely unwanted, so ignore it
|
||||
return path.find("/node_modules/") == std::string::npos && path.find("\\node_modules\\") == std::string::npos;
|
||||
}
|
||||
|
||||
void ScriptEngine::AutoReloadPlugins()
|
||||
{
|
||||
if (_changedPluginFiles.size() > 0)
|
||||
|
||||
Reference in new issue
Block a user