diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-05-21 19:37:15 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-05-21 19:37:15 +0300 |
| commit | 15d82beb6056fa16a1ea1cbf01c5d673a95e0267 (patch) | |
| tree | 55af7639161926313434d9e4a8b9872369668d5d /indra/llfilesystem/llfilesystem.cpp | |
| parent | ff536adef0b74c20f55bd501ad593e4eef762082 (diff) | |
| parent | 6d4c4c029ce43aa413266135829cd2bc00001890 (diff) | |
Merge branch 'main' into marchcat/slua-26.2
# Conflicts:
# indra/llfilesystem/lldir.cpp
# indra/llfilesystem/llfilesystem.cpp
# indra/newview/llappviewer.cpp
# indra/newview/lltexturecache.cpp
# indra/newview/llvoiceclient.cpp
# indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
Diffstat (limited to 'indra/llfilesystem/llfilesystem.cpp')
| -rw-r--r-- | indra/llfilesystem/llfilesystem.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 388cbc280f..dcebec494f 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -33,6 +33,7 @@ #include "llfilesystem.h" #include "llfasttimer.h" #include "lldiskcache.h" +#include "boost/filesystem.hpp" constexpr S32 LLFileSystem::READ = 0x00000001; constexpr S32 LLFileSystem::WRITE = 0x00000002; @@ -74,9 +75,12 @@ bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType fil LL_PROFILE_ZONE_SCOPED; const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); - // not only test for existence but for the file to be not empty - S64 size = LLFile::size(filename); - return size > 0; + boost::system::error_code ec; + if (boost::filesystem::exists(filename, ec) && boost::filesystem::is_regular_file(filename, ec)) + { + return boost::filesystem::file_size(filename, ec) > 0; + } + return false; } // static @@ -108,6 +112,19 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp return true; } +// static +S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType file_type) +{ + const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); + + boost::system::error_code ec; + if (boost::filesystem::exists(filename, ec) && boost::filesystem::is_regular_file(filename, ec)) + { + return static_cast<S32>(boost::filesystem::file_size(filename, ec)); + } + return 0; +} + bool LLFileSystem::read(U8* buffer, S32 bytes) { bool success = false; |
