Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions indra/llfilesystem/lldiskcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "llapp.h"
#include "llassettype.h"
#include "lldir.h"
#include "llstring.h"
#include <chrono>
#include <filesystem>

Expand Down Expand Up @@ -116,14 +117,14 @@ void LLDiskCache::purge()
}
if (std::filesystem::is_regular_file(*iter, ec) && !ec)
{
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
if (fsyspath((*iter).path()).string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
{
uintmax_t file_size = std::filesystem::file_size(*iter, ec);
if (ec)
{
continue;
}
const std::string file_path = (*iter).path().string();
const std::string file_path = fsyspath((*iter).path()).string();
Comment thread
akleshchev marked this conversation as resolved.
const std::filesystem::file_time_type file_time = std::filesystem::last_write_time(*iter, ec);
if (ec)
{
Expand Down Expand Up @@ -165,7 +166,7 @@ void LLDiskCache::purge()
}
if (should_remove)
{
std::filesystem::remove(entry.second.second, ec);
std::filesystem::remove(fsyspath(entry.second.second), ec);
if (ec)
{
LL_WARNS() << "Failed to delete cache file " << entry.second.second << ": " << ec.message() << LL_ENDL;
Expand Down Expand Up @@ -245,7 +246,7 @@ void LLDiskCache::clearCache()
{
if (std::filesystem::is_regular_file(*iter, ec) && !ec)
{
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
if (fsyspath((*iter).path()).string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
{
std::filesystem::remove(*iter, ec);
if (ec)
Expand Down Expand Up @@ -274,8 +275,9 @@ void LLDiskCache::removeOldVFSFiles()
{
if (std::filesystem::is_regular_file(*iter, ec) && !ec)
{
if (((*iter).path().string().find(CACHE_FORMAT) != std::string::npos) ||
((*iter).path().string().find(DB_FORMAT) != std::string::npos))
const std::string file_path = fsyspath((*iter).path()).string();
if ((file_path.find(CACHE_FORMAT) != std::string::npos) ||
(file_path.find(DB_FORMAT) != std::string::npos))
{
std::filesystem::remove(*iter, ec);
if (ec)
Expand Down Expand Up @@ -311,7 +313,7 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir)
{
if (std::filesystem::is_regular_file(*iter, ec) && !ec)
{
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
if (fsyspath((*iter).path()).string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
{
uintmax_t file_size = std::filesystem::file_size(*iter, ec);
if (!ec)
Expand Down
Loading