diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-09-16 20:44:37 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-09-16 21:07:39 +0300 |
commit | 76491145885eb672961b564fa782af3777e08f12 (patch) | |
tree | 0929e225b721b2d4966d5cd205380c3b53d94446 /indra/llfilesystem/lldiskcache.cpp | |
parent | 5a3631659fb4fe8c2b70c90c490a6c7e486289e9 (diff) | |
parent | f83289d3a7e80bebe47f696f96aee1b7e64d1d69 (diff) |
Merge branch master (DRTVWR-571) into DRTVWR-559
# Conflicts:
# indra/newview/llpanelface.cpp
# indra/newview/llpanelface.h
Diffstat (limited to 'indra/llfilesystem/lldiskcache.cpp')
-rw-r--r-- | indra/llfilesystem/lldiskcache.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 538446d732..022d206821 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -355,6 +355,38 @@ void LLDiskCache::clearCache() } } +void LLDiskCache::removeOldVFSFiles() +{ + //VFS files won't be created, so consider removing this code later + static const char CACHE_FORMAT[] = "inv.llsd"; + static const char DB_FORMAT[] = "db2.x"; + + boost::system::error_code ec; +#if LL_WINDOWS + std::wstring cache_path(utf8str_to_utf16str(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""))); +#else + std::string cache_path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")); +#endif + if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + { + for (auto& entry : boost::make_iterator_range(boost::filesystem::directory_iterator(cache_path, ec), {})) + { + if (boost::filesystem::is_regular_file(entry, ec) && !ec.failed()) + { + if ((entry.path().string().find(CACHE_FORMAT) != std::string::npos) || + (entry.path().string().find(DB_FORMAT) != std::string::npos)) + { + boost::filesystem::remove(entry, ec); + if (ec.failed()) + { + LL_WARNS() << "Failed to delete cache file " << entry << ": " << ec.message() << LL_ENDL; + } + } + } + } + } +} + uintmax_t LLDiskCache::dirFileSize(const std::string dir) { uintmax_t total_file_size = 0; |