Add missing plugin error
Previously, if a plugin was included but the folder had no lua files, the error given was ambiguous. Now, it explicitly describes lack of lua files. See issue #512 P.S. This probably isn't the best way, but this is where the fix can be made.
This commit is contained in:
parent
6c469ec1f5
commit
e0d94e0f06
@ -90,6 +90,8 @@ bool cPluginLua::Initialize(void)
|
|||||||
|
|
||||||
// Load all files for this plugin, and execute them
|
// Load all files for this plugin, and execute them
|
||||||
AStringVector Files = cFile::GetFolderContents(PluginPath.c_str());
|
AStringVector Files = cFile::GetFolderContents(PluginPath.c_str());
|
||||||
|
|
||||||
|
int numFiles = 0;
|
||||||
for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
|
for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->rfind(".lua") == AString::npos)
|
if (itr->rfind(".lua") == AString::npos)
|
||||||
@ -101,9 +103,19 @@ bool cPluginLua::Initialize(void)
|
|||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
return false;
|
return false;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
numFiles++;
|
||||||
}
|
}
|
||||||
} // for itr - Files[]
|
} // for itr - Files[]
|
||||||
|
|
||||||
|
if (numFiles == 0) // no lua files found
|
||||||
|
{
|
||||||
|
LOGWARNING("No lua files found: plugin %s is missing.", GetName().c_str());
|
||||||
|
Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Call intialize function
|
// Call intialize function
|
||||||
bool res = false;
|
bool res = false;
|
||||||
if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res))
|
if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res))
|
||||||
|
Loading…
Reference in New Issue
Block a user