diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-12-11 01:42:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-11 01:42:52 +0200 |
| commit | c92b0b74cbd963cd79d1cb7754256b801f1479b1 (patch) | |
| tree | 5f3cf34559856bdafd950acf0c9a4d6dec59f0bc /indra/llfilesystem/llfilesystem.cpp | |
| parent | dbbce566e7d66c907dde7bd6c4212b0954b9a5e1 (diff) | |
Revert #4899 "Add more functionality to LLFile and cleanup LLAPRFile"
Interferes with linux work, will be moved to a different branch and applied separately.
Diffstat (limited to 'indra/llfilesystem/llfilesystem.cpp')
| -rw-r--r--[-rwxr-xr-x] | indra/llfilesystem/llfilesystem.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 0c220fe7cf..541266af4f 100755..100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -77,17 +77,21 @@ 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; + llifstream file(filename, std::ios::binary); + if (file.is_open()) + { + file.seekg(0, std::ios::end); + return file.tellg() > 0; + } + return false; } // static -bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_warning /*= 0*/) +bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error /*= 0*/) { const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); - LLFile::remove(filename.c_str(), suppress_warning); + LLFile::remove(filename.c_str(), suppress_error); return true; } @@ -112,10 +116,19 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp } // static -S64 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType file_type) +S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType file_type) { const std::string filename = LLDiskCache::metaDataToFilepath(file_id, file_type); - return LLFile::size(filename); + + S32 file_size = 0; + llifstream file(filename, std::ios::binary); + if (file.is_open()) + { + file.seekg(0, std::ios::end); + file_size = (S32)file.tellg(); + } + + return file_size; } bool LLFileSystem::read(U8* buffer, S32 bytes) @@ -256,7 +269,7 @@ S32 LLFileSystem::tell() const S32 LLFileSystem::getSize() const { - return (S32)LLFileSystem::getFileSize(mFileID, mFileType); + return LLFileSystem::getFileSize(mFileID, mFileType); } S32 LLFileSystem::getMaxSize() const |
