mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Eluna fix linux script loading - Still require adding a config setting to set a path to allow you to use a fixed path with restarters and shortcuts
This commit is contained in:
@@ -76,7 +76,7 @@ bool StartEluna()
|
||||
|
||||
ScriptPaths scripts;
|
||||
sEluna->GetScripts("lua_scripts", scripts);
|
||||
sEluna->GetScripts("lua_scripts\\extensions", scripts);
|
||||
sEluna->GetScripts("lua_scripts/extensions", scripts);
|
||||
sEluna->RunScripts(scripts);
|
||||
|
||||
/*
|
||||
@@ -113,6 +113,8 @@ bool StartEluna()
|
||||
// Finds lua script files from given path (including subdirectories) and pushes them to scripts
|
||||
void Eluna::GetScripts(std::string path, ScriptPaths& scripts)
|
||||
{
|
||||
ELUNA_LOG_DEBUG("Eluna::GetScripts from path `%s`", path.c_str());
|
||||
|
||||
ACE_Dirent dir;
|
||||
if (dir.open(path.c_str()) == -1)
|
||||
{
|
||||
@@ -142,11 +144,13 @@ void Eluna::GetScripts(std::string path, ScriptPaths& scripts)
|
||||
}
|
||||
|
||||
// was file, check extension
|
||||
ELUNA_LOG_DEBUG("[Eluna]: GetScripts Checking file `%s`", fullpath.c_str());
|
||||
std::string ext = fullpath.substr(fullpath.length() - 4, 4);
|
||||
if (ext != ".lua" && ext != ".dll")
|
||||
continue;
|
||||
|
||||
// was correct, add path to scripts to load
|
||||
ELUNA_LOG_DEBUG("[Eluna]: GetScripts add path `%s`", fullpath.c_str());
|
||||
scripts.erase(fullpath);
|
||||
scripts.insert(fullpath);
|
||||
}
|
||||
@@ -161,14 +165,14 @@ void Eluna::RunScripts(ScriptPaths& scripts)
|
||||
if (!luaL_loadfile(L, it->c_str()) && !lua_pcall(L, 0, 0, 0))
|
||||
{
|
||||
// successfully loaded and ran file
|
||||
ELUNA_LOG_DEBUG("[Eluna]: Successfully loaded `%s`.", it->c_str());
|
||||
ELUNA_LOG_DEBUG("[Eluna]: Successfully loaded `%s`", it->c_str());
|
||||
++count;
|
||||
continue;
|
||||
}
|
||||
ELUNA_LOG_ERROR("[Eluna]: Error loading file `%s`.", it->c_str());
|
||||
ELUNA_LOG_ERROR("[Eluna]: Error loading file `%s`", it->c_str());
|
||||
report(L);
|
||||
}
|
||||
ELUNA_LOG_INFO("[Eluna]: Loaded %u Lua scripts..", count);
|
||||
ELUNA_LOG_INFO("[Eluna]: Loaded %u Lua scripts", count);
|
||||
}
|
||||
|
||||
void Eluna::report(lua_State* L)
|
||||
|
||||
@@ -2032,7 +2032,7 @@ namespace LuaPlayer
|
||||
{
|
||||
std::string msg = sEluna->CHECKVAL<std::string>(L, 2);
|
||||
if (msg.length() > 0)
|
||||
player->GetSession()->SendAreaTriggerMessage(msg.c_str());
|
||||
player->GetSession()->SendAreaTriggerMessage("%s", msg.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2040,7 +2040,7 @@ namespace LuaPlayer
|
||||
{
|
||||
std::string msg = sEluna->CHECKVAL<std::string>(L, 2);
|
||||
if (msg.length() > 0)
|
||||
player->GetSession()->SendNotification(msg.c_str());
|
||||
player->GetSession()->SendNotification("%s", msg.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user