From 060dd2aeab72df26d6375f2e0fad619113fe7e13 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 16 Sep 2020 19:03:48 +0300 Subject: Check existence of local files instead of checking VFS --- indra/llvfs/llvfile.cpp | 16 ++++++++++++++++ indra/llvfs/llvfile.h | 2 ++ 2 files changed, 18 insertions(+) (limited to 'indra/llvfs') 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(); -- cgit v1.2.3