mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Return immediatly from fs::remove_all on failure to remove entries
This way error code will be reflected properly
This commit is contained in:
parent
0a5b6ad928
commit
d48d424b19
@ -1539,7 +1539,7 @@ const std::string& fs::get_cache_dir()
|
|||||||
return s_dir;
|
return s_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fs::remove_all(const std::string& path, bool remove_root)
|
bool fs::remove_all(const std::string& path, bool remove_root)
|
||||||
{
|
{
|
||||||
for (const auto& entry : dir(path))
|
for (const auto& entry : dir(path))
|
||||||
{
|
{
|
||||||
@ -1550,19 +1550,27 @@ void fs::remove_all(const std::string& path, bool remove_root)
|
|||||||
|
|
||||||
if (entry.is_directory == false)
|
if (entry.is_directory == false)
|
||||||
{
|
{
|
||||||
remove_file(path + '/' + entry.name);
|
if (!remove_file(path + '/' + entry.name))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.is_directory == true)
|
if (entry.is_directory == true)
|
||||||
{
|
{
|
||||||
remove_all(path + '/' + entry.name);
|
if (!remove_all(path + '/' + entry.name))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remove_root)
|
if (remove_root)
|
||||||
{
|
{
|
||||||
remove_dir(path);
|
return remove_dir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 fs::get_dir_size(const std::string& path)
|
u64 fs::get_dir_size(const std::string& path)
|
||||||
|
@ -503,7 +503,7 @@ namespace fs
|
|||||||
const std::string& get_cache_dir();
|
const std::string& get_cache_dir();
|
||||||
|
|
||||||
// Delete directory and all its contents recursively
|
// Delete directory and all its contents recursively
|
||||||
void remove_all(const std::string& path, bool remove_root = true);
|
bool remove_all(const std::string& path, bool remove_root = true);
|
||||||
|
|
||||||
// Get size of all files recursively
|
// Get size of all files recursively
|
||||||
u64 get_dir_size(const std::string& path);
|
u64 get_dir_size(const std::string& path);
|
||||||
|
Loading…
Reference in New Issue
Block a user