summaryrefslogtreecommitdiff
path: root/indra/llvfs
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-09-16 19:03:48 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-09-16 19:03:48 +0300
commit060dd2aeab72df26d6375f2e0fad619113fe7e13 (patch)
treee004f24cd076b37ec2413bc9bd90f1923c6fbb6e /indra/llvfs
parent8c289ec126edf510a542c86e4c9df1787a37acb6 (diff)
Check existence of local files instead of checking VFS
Diffstat (limited to 'indra/llvfs')
-rw-r--r--indra/llvfs/llvfile.cpp16
-rw-r--r--indra/llvfs/llvfile.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/indra/llvfs/llvfile.cpp b/indra/llvfs/llvfile.cpp
index 797b431b93..d05c419d89 100644
--- a/indra/llvfs/llvfile.cpp
+++ b/indra/llvfs/llvfile.cpp
@@ -124,6 +124,7 @@ const std::string assetTypeToString(LLAssetType::EType at)
{ LLAssetType::AT_WIDGET, "WIDGET" },
{ LLAssetType::AT_PERSON, "PERSON" },
{ LLAssetType::AT_MESH, "MESH" },
+ { LLAssetType::AT_SETTINGS, "SETTINGS" },
{ LLAssetType::AT_UNKNOWN, "UNKNOWN" }
};
@@ -154,6 +155,21 @@ const std::string idToFilepath(const std::string id, LLAssetType::EType at)
return filepath;
}
+bool LLVFile::getExists(const LLUUID &file_id, const LLAssetType::EType file_type)
+{
+ std::string id_str;
+ file_id.toString(id_str);
+ const std::string filename = idToFilepath(id_str, file_type);
+
+ std::ifstream file(filename, std::ios::binary);
+ if (file.is_open())
+ {
+ file.seekg(0, std::ios::end);
+ return file.tellg() > 0;
+ }
+ return false;
+}
+
BOOL LLVFile::read(U8 *buffer, S32 bytes, BOOL async, F32 priority)
{
//CP BEGIN
diff --git a/indra/llvfs/llvfile.h b/indra/llvfs/llvfile.h
index 4aeb9c9630..71dd273404 100644
--- a/indra/llvfs/llvfile.h
+++ b/indra/llvfs/llvfile.h
@@ -58,6 +58,8 @@ public:
bool isLocked(EVFSLock lock);
void waitForLock(EVFSLock lock);
+
+ static bool getExists(const LLUUID &file_id, const LLAssetType::EType file_type);
static void initClass(LLVFSThread* vfsthread = NULL);
static void cleanupClass();