summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-02 19:07:02 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-02 19:07:02 -0400
commit1913ea4ec2f46458e2971e6e02afacf4da670af2 (patch)
treecb929e008a2670c920eb2708d27a5cb49972a818 /indra
parentffe3db1c2d16a640a8da0ed069c62617812ce7e3 (diff)
Search --luafile script on LuaCommandPath.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappviewer.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index ef12fe0bd3..ff29f64aeb 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -113,6 +113,7 @@
#include "llgltfmateriallist.h"
// Linden library includes
+#include "fsyspath.h"
#include "llavatarnamecache.h"
#include "lldiriterator.h"
#include "llexperiencecache.h"
@@ -1216,8 +1217,23 @@ bool LLAppViewer::init()
"--luafile", "LuaScript",
[](const LLSD& script)
{
- // no completion callback: we don't need to know
- LLLUAmanager::runScriptFile(script);
+ LLSD paths(gSavedSettings.getLLSD("LuaCommandPath"));
+ LL_DEBUGS("Lua") << "LuaCommandPath = " << paths << LL_ENDL;
+ for (const auto& path : llsd::inArray(paths))
+ {
+ // if script path is already absolute, operator/() preserves it
+ auto abspath(fsyspath(gDirUtilp->getAppRODataDir()) / path.asString());
+ auto absscript{ (abspath / script.asString()) };
+ std::error_code ec;
+ if (std::filesystem::exists(absscript, ec))
+ {
+ // no completion callback: we don't need to know
+ LLLUAmanager::runScriptFile(absscript.u8string());
+ return; // from lambda
+ }
+ }
+ LL_WARNS("Lua") << "--luafile " << std::quoted(script.asString())
+ << " not found on " << paths << LL_ENDL;
});
processComposeSwitch(
"LuaAutorunPath", "LuaAutorunPath",