summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/lldir.cpp
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-05-06 15:44:19 -0700
committerGitHub <noreply@github.com>2024-05-06 15:44:19 -0700
commit84827a7cb8d4b7a58309f98c7d4df4cfeb173935 (patch)
treeb91494298eab93bbd8dd9b00722b7a30714a1b9c /indra/llfilesystem/lldir.cpp
parent76101843c0d390c25a783f212eb1ea75e508ada4 (diff)
parent8b747cee182cd8e95063fa152d9b5d7383cb1c74 (diff)
Merge pull request #1413 from secondlife/gltf-dev-maint-a-merge
Merge Maint A to development
Diffstat (limited to 'indra/llfilesystem/lldir.cpp')
-rw-r--r--indra/llfilesystem/lldir.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index 41fbb97175..0ba62fb698 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -70,6 +70,7 @@ LLDir *gDirUtilp = (LLDir *)&gDirUtil;
/// Values for findSkinnedFilenames(subdir) parameter
const char
*LLDir::XUI = "xui",
+ *LLDir::HTML = "html",
*LLDir::TEXTURES = "textures",
*LLDir::SKINBASE = "";
@@ -760,14 +761,13 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
else
{
// We do not recognize this subdir. Investigate.
- std::string subdir_path(add(getDefaultSkinDir(), subdir));
- if (fileExists(add(subdir_path, "en")))
+ if (skinExists(subdir, "en"))
{
// defaultSkinDir/subdir contains subdir "en". That's our
// default language; this subdir is localized.
found = sLocalized.insert(StringMap::value_type(subdir, "en")).first;
}
- else if (fileExists(add(subdir_path, "en-us")))
+ else if (skinExists(subdir, "en-us"))
{
// defaultSkinDir/subdir contains subdir "en-us" but not "en".
// Set as default language; this subdir is localized.
@@ -864,6 +864,33 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
return results;
}
+// virtual
+bool LLDir::skinExists(const std::string& subdir, const std::string& skin) const
+{
+ std::string skin_path(add(getDefaultSkinDir(), subdir, skin));
+ return fileExists(skin_path);
+}
+
+// virtual
+std::string LLDir::getFileContents(const std::string& filename) const
+{
+ LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
+ if (fp)
+ {
+ fseek(fp, 0, SEEK_END);
+ U32 length = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+
+ std::vector<char> buffer(length);
+ size_t nread = fread(buffer.data(), 1, length, fp);
+ fclose(fp);
+
+ return std::string(buffer.data(), nread);
+ }
+
+ return LLStringUtil::null;
+}
+
std::string LLDir::getTempFilename() const
{
LLUUID random_uuid;