Boost throws exceptions
This commit is contained in:
@@ -133,47 +133,55 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
|
|||||||
llassert(!"Invalid file mask");
|
llassert(!"Invalid file mask");
|
||||||
}
|
}
|
||||||
|
|
||||||
LLDirIterator iter(dirname, mask);
|
try
|
||||||
while (iter.next(filename))
|
|
||||||
{
|
{
|
||||||
fullpath = add(dirname, filename);
|
LLDirIterator iter(dirname, mask);
|
||||||
|
while (iter.next(filename))
|
||||||
if(LLFile::isdir(fullpath))
|
|
||||||
{
|
{
|
||||||
// skipping directory traversal filenames
|
fullpath = add(dirname, filename);
|
||||||
count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 retry_count = 0;
|
if(LLFile::isdir(fullpath))
|
||||||
while (retry_count < 5)
|
|
||||||
{
|
|
||||||
if (0 != LLFile::remove(fullpath))
|
|
||||||
{
|
{
|
||||||
retry_count++;
|
// skipping directory traversal filenames
|
||||||
result = errno;
|
count++;
|
||||||
llwarns << "Problem removing " << fullpath << " - errorcode: "
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 retry_count = 0;
|
||||||
|
while (retry_count < 5)
|
||||||
|
{
|
||||||
|
if (0 != LLFile::remove(fullpath))
|
||||||
|
{
|
||||||
|
retry_count++;
|
||||||
|
result = errno;
|
||||||
|
llwarns << "Problem removing " << fullpath << " - errorcode: "
|
||||||
<< result << " attempt " << retry_count << llendl;
|
<< result << " attempt " << retry_count << llendl;
|
||||||
|
|
||||||
if(retry_count >= 5)
|
if(retry_count >= 5)
|
||||||
{
|
{
|
||||||
llwarns << "Failed to remove " << fullpath << llendl ;
|
llwarns << "Failed to remove " << fullpath << llendl ;
|
||||||
return count ;
|
return count ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ms_sleep(100);
|
ms_sleep(100);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (retry_count)
|
|
||||||
{
|
|
||||||
llwarns << "Successfully removed " << fullpath << llendl;
|
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
}
|
{
|
||||||
|
if (retry_count)
|
||||||
|
{
|
||||||
|
llwarns << "Successfully removed " << fullpath << llendl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
llwarns << "Unable to remove some files from " + dirname << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +197,7 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name)
|
|||||||
}
|
}
|
||||||
catch(const boost::filesystem::filesystem_error& e)
|
catch(const boost::filesystem::filesystem_error& e)
|
||||||
{
|
{
|
||||||
llinfos << "boost::filesystem::remove_all(\"" + dir_name + "\") failed: '" + e.code().message() + "'" << llendl;
|
llwarns << "boost::filesystem::remove_all(\"" + dir_name + "\") failed: '" + e.code().message() + "'" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Reference in New Issue
Block a user