Fixed EXT-6423(normal) - Windows viewer spends a minute clearing cache when there is no cache

Problem description:
The code that purges cache does not expect any folders there, error occurs when it tries to delete a file, which is actually a folder. To handle an error the code sleeps for 1 second and tries to delete the file 4 more times(sleeping for 1 second after each try).
Fix info:
Using LLFile::isDir to skip directories and only delete files.

Reviewed by Vadim Savchuk - https://codereview.productengine.com/secondlife/r/239/

--HG--
branch : product-engine
master
Dmitry Zaporozhan 2010-04-16 09:25:40 +03:00
parent c0ad2a55ba
commit 492efd6678
1 changed files with 5 additions and 4 deletions

View File

@ -91,15 +91,16 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
S32 result;
while (getNextFileInDir(dirname, mask, filename, FALSE))
{
if ((filename == ".") || (filename == ".."))
fullpath = dirname;
fullpath += getDirDelimiter();
fullpath += filename;
if(LLFile::isdir(fullpath))
{
// skipping directory traversal filenames
count++;
continue;
}
fullpath = dirname;
fullpath += getDirDelimiter();
fullpath += filename;
S32 retry_count = 0;
while (retry_count < 5)