summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-06-28 13:21:14 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-06-28 13:21:14 -0400
commitac56718929044e101dc2c7bfe3ebc5dff565b76d (patch)
treed94b28ad3b4007f5e8f8e2c7aa13f3e809873dfa /indra/newview/llappviewer.cpp
parentcfd7d8905d686411a774c47bbfc13f49882b65e6 (diff)
Add LuaAutorunPath, LuaCommandPath and LuaRequirePath settings.
Remove AutorunLuaScriptFile and the LLLUAmanager::runScriptOnLogin() method that checked it. Instead, iterate over LuaAutorunPath directories at viewer startup, iterate over *.lua files in each and implicitly run those. LuaCommandPath and LuaRequirePath are not yet implemented.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 65e5e4f783..ef12fe0bd3 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -117,6 +117,7 @@
#include "lldiriterator.h"
#include "llexperiencecache.h"
#include "llimagej2c.h"
+#include "llluamanager.h"
#include "llmemory.h"
#include "llprimitive.h"
#include "llurlaction.h"
@@ -1218,6 +1219,24 @@ bool LLAppViewer::init()
// no completion callback: we don't need to know
LLLUAmanager::runScriptFile(script);
});
+ processComposeSwitch(
+ "LuaAutorunPath", "LuaAutorunPath",
+ [](const LLSD& directory)
+ {
+ // each directory can be relative to the viewer's install
+ // directory -- if directory is already absolute, operator/()
+ // preserves it
+ auto abspath(fsyspath(gDirUtilp->getAppRODataDir()) / directory.asString());
+ std::string absdir(abspath.string());
+ LL_DEBUGS("InitInfo") << "LuaAutorunPath: " << absdir << LL_ENDL;
+ LLDirIterator scripts(absdir, "*.lua");
+ std::string script;
+ while (scripts.next(script))
+ {
+ LL_DEBUGS("InitInfo") << "LuaAutorunPath: " << absdir << ": " << script << LL_ENDL;
+ LLLUAmanager::runScriptFile((abspath / script).string());
+ }
+ });
if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
{