From 84e806f71492a76ab28e049ec255df479ffbb339 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 29 Apr 2026 14:43:08 -0700 Subject: Added support to jsonrpc server for the viewer based syntax cache. --- indra/newview/llsyntaxid.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra/newview/llsyntaxid.cpp') diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 3d0a9d80b4..3e6fc2d217 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -506,6 +506,16 @@ void LLSyntaxDefCache::loadKeywordsIntoLLSD() mSyntaxIDChangedSignal(); } +std::vector LLSyntaxDefCache::getCacheFileNames() const +{ + std::vector names; + for (const auto& [name, path] : mFileCachePaths) + { + names.push_back(name); + } + return names; +} + LLSD LLSyntaxDefCache::loadDeserializedCacheFile(const std::string& file_path) { std::ifstream file(file_path.c_str()); @@ -524,3 +534,32 @@ LLSD LLSyntaxDefCache::loadDeserializedCacheFile(const std::string& file_path) return LLSD(); } +std::string LLSyntaxDefCache::loadCacheFile(const std::string& name) const +{ + std::string full_path = mFileCachePaths.getPath(name); + if (!full_path.empty()) + { + std::ifstream file(full_path.c_str()); + if (file.good()) + { + std::ostringstream ss; + ss << file.rdbuf(); + return (file.good()) ? ss.str() : std::string(); + } + else + { + LL_WARNS("SyntaxLSL") << "Failed to open cached file: " << full_path << LL_ENDL; + } + } + return std::string(); +} + +LLSD LLSyntaxDefCache::loadCacheFileAsLLSD(const std::string& name) const +{ + std::string full_path = mFileCachePaths.getPath(name); + if (!full_path.empty()) + { + return loadDeserializedCacheFile(full_path); + } + return LLSD(); +} -- cgit v1.3