mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Exclude node_modules directory
This commit is contained in:
@@ -86,6 +86,8 @@ void ScriptEngine::LoadPlugins()
|
|||||||
while (scanner->Next())
|
while (scanner->Next())
|
||||||
{
|
{
|
||||||
auto path = std::string(scanner->GetPath());
|
auto path = std::string(scanner->GetPath());
|
||||||
|
if (ShouldLoadScript(path))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto plugin = std::make_shared<Plugin>(_context, path);
|
auto plugin = std::make_shared<Plugin>(_context, path);
|
||||||
@@ -98,6 +100,7 @@ void ScriptEngine::LoadPlugins()
|
|||||||
_console.WriteLineError(e.what());
|
_console.WriteLineError(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -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()
|
void ScriptEngine::AutoReloadPlugins()
|
||||||
{
|
{
|
||||||
if (_changedPluginFiles.size() > 0)
|
if (_changedPluginFiles.size() > 0)
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ namespace OpenRCT2::Scripting
|
|||||||
void Initialise();
|
void Initialise();
|
||||||
void LoadPlugins();
|
void LoadPlugins();
|
||||||
void StartPlugins();
|
void StartPlugins();
|
||||||
|
bool ShouldLoadScript(const std::string& path);
|
||||||
void AutoReloadPlugins();
|
void AutoReloadPlugins();
|
||||||
};
|
};
|
||||||
} // namespace OpenRCT2::Scripting
|
} // namespace OpenRCT2::Scripting
|
||||||
|
|||||||
Reference in New Issue
Block a user