From e0d94e0f06e5e39319f68497479720e04f10ce58 Mon Sep 17 00:00:00 2001 From: Bill Derouin Date: Tue, 7 Jan 2014 13:47:15 -0600 Subject: 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. --- src/Bindings/PluginLua.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 209842e55..196a4f730 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -90,6 +90,8 @@ bool cPluginLua::Initialize(void) // Load all files for this plugin, and execute them AStringVector Files = cFile::GetFolderContents(PluginPath.c_str()); + + int numFiles = 0; for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) { if (itr->rfind(".lua") == AString::npos) @@ -101,9 +103,19 @@ bool cPluginLua::Initialize(void) { Close(); return false; + } else + { + numFiles++; } } // 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 bool res = false; if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res)) -- cgit v1.2.3 From 154d6b989a242b8d3c6bb24cc64c6fedb2109ad6 Mon Sep 17 00:00:00 2001 From: Bill Derouin Date: Wed, 8 Jan 2014 13:45:16 -0600 Subject: A couple touchups --- src/Bindings/PluginLua.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 196a4f730..eefcd2b09 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -103,13 +103,14 @@ bool cPluginLua::Initialize(void) { Close(); return false; - } else + } + else { numFiles++; } } // for itr - Files[] - if (numFiles == 0) // no lua files found + if (numFiles == 0) { LOGWARNING("No lua files found: plugin %s is missing.", GetName().c_str()); Close(); -- cgit v1.2.3