Skip to content
Snippets Groups Projects
Commit 39e5c863 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix crashing on failure to boost::filesystem::remove

parent 24813f83
Branches
Tags
1 merge request!16Various package rebuilds and updates including movement to zlib-ng and mac support
...@@ -207,11 +207,21 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name) ...@@ -207,11 +207,21 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name)
{ {
if (!boost::filesystem::is_empty (dir_path)) if (!boost::filesystem::is_empty (dir_path))
{ // Directory has content { // Directory has content
num_deleted = boost::filesystem::remove_all (dir_path); boost::system::error_code ec;
num_deleted = boost::filesystem::remove_all(dir_path, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete file " << dir_path << ": " << ec.message() << LL_ENDL;
}
} }
else else
{ // Directory is empty { // Directory is empty
boost::filesystem::remove (dir_path); boost::system::error_code ec;
num_deleted = boost::filesystem::remove(dir_path, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete folder " << dir_path << ": " << ec.message() << LL_ENDL;
}
} }
} }
} }
......
...@@ -113,7 +113,12 @@ void LLDiskCache::purge() ...@@ -113,7 +113,12 @@ void LLDiskCache::purge()
if (file_size_total > mMaxSizeBytes) if (file_size_total > mMaxSizeBytes)
{ {
remove_file = true; remove_file = true;
boost::filesystem::remove(entry.second.second); boost::system::error_code ec;
boost::filesystem::remove(entry.second.second, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete cached file " << entry.second.second << ": " << ec.message() << LL_ENDL;
}
} }
if (mEnableCacheDebugInfo) if (mEnableCacheDebugInfo)
...@@ -220,7 +225,12 @@ void LLDiskCache::clearCache() ...@@ -220,7 +225,12 @@ void LLDiskCache::clearCache()
#endif #endif
if (boost::filesystem::is_directory(cache_path)) if (boost::filesystem::is_directory(cache_path))
{ {
boost::filesystem::remove_all(cache_path); boost::system::error_code ec;
boost::filesystem::remove_all(cache_path, ec);
if (ec.failed())
{
LL_WARNS() << "Failed to delete cached files " << cache_path << ": " << ec.message() << LL_ENDL;
}
createCache(); createCache();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment