summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-10-21 18:43:27 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-10-21 18:43:27 +0000
commitb004c67cff61e0fa772cc06b3bed515b5e05d68d (patch)
tree4ca5234388b96c47c1dc60df7928db5b32e03050 /plugins/MirLua/src
parentc99bbd2ef7f9fb2295ff2ec07bb690c4d7351a71 (diff)
MirLua: fixed disabled script loading
git-svn-id: http://svn.miranda-ng.org/main/trunk@15587 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src')
-rw-r--r--plugins/MirLua/src/mlua_script_loader.cpp20
-rw-r--r--plugins/MirLua/src/mlua_script_loader.h2
2 files changed, 9 insertions, 13 deletions
diff --git a/plugins/MirLua/src/mlua_script_loader.cpp b/plugins/MirLua/src/mlua_script_loader.cpp
index d26ccd1e90..34ee40256c 100644
--- a/plugins/MirLua/src/mlua_script_loader.cpp
+++ b/plugins/MirLua/src/mlua_script_loader.cpp
@@ -18,12 +18,16 @@ void CLuaScriptLoader::RegisterScriptsFolder(const char *path)
lua_pop(L, 1);
}
-void CLuaScriptLoader::LoadScript(const TCHAR *path, int iGroup)
+void CLuaScriptLoader::LoadScript(const TCHAR *scriptDir, const TCHAR *file, int iGroup)
{
+ TCHAR fullPath[MAX_PATH], path[MAX_PATH];
+ mir_sntprintf(fullPath, _T("%s\\%s"), scriptDir, file);
+ PathToRelativeT(fullPath, path);
+
CMLuaScript *script = new CMLuaScript(L, path, iGroup);
g_mLua->Scripts.insert(script);
- if (script->Load())
+ if (db_get_b(NULL, MODULE, _T2A(file), 1) && script->Load())
{
TCHAR buf[4096];
mir_sntprintf(buf, _T("%s:OK"), path);
@@ -42,22 +46,14 @@ void CLuaScriptLoader::LoadScripts(const TCHAR *scriptDir, int iGroup)
TCHAR searchMask[MAX_PATH];
mir_sntprintf(searchMask, _T("%s\\%s"), scriptDir, _T("*.lua"));
- TCHAR fullPath[MAX_PATH], path[MAX_PATH];
-
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(searchMask, &fd);
if (hFind != INVALID_HANDLE_VALUE)
{
do
- {
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
- {
- mir_sntprintf(fullPath, _T("%s\\%s"), scriptDir, fd.cFileName);
- PathToRelativeT(fullPath, path);
- if (db_get_b(NULL, MODULE, _T2A(fd.cFileName), 1))
- LoadScript(fullPath, iGroup);
- }
- } while (FindNextFile(hFind, &fd));
+ LoadScript(scriptDir, fd.cFileName, iGroup);
+ while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
diff --git a/plugins/MirLua/src/mlua_script_loader.h b/plugins/MirLua/src/mlua_script_loader.h
index 7510b167c7..e7844b6e76 100644
--- a/plugins/MirLua/src/mlua_script_loader.h
+++ b/plugins/MirLua/src/mlua_script_loader.h
@@ -10,7 +10,7 @@ private:
void RegisterScriptsFolder(const char *path);
- void LoadScript(const TCHAR *path, int iGroup = 0);
+ void LoadScript(const TCHAR *scriptDir, const TCHAR *file, int iGroup = 0);
void LoadScripts(const TCHAR *scriptDir, int iGroup = 0);
public: