mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
Fixup after #6329
This commit is contained in:
parent
a4896eb6df
commit
95f22b76c6
1 changed files with 22 additions and 15 deletions
|
@ -1541,30 +1541,37 @@ const std::string& fs::get_cache_dir()
|
||||||
|
|
||||||
bool 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))
|
if (const auto root_dir = dir(path))
|
||||||
{
|
{
|
||||||
if (entry.name == "." || entry.name == "..")
|
for (const auto& entry : root_dir)
|
||||||
{
|
{
|
||||||
continue;
|
if (entry.name == "." || entry.name == "..")
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.is_directory == false)
|
|
||||||
{
|
|
||||||
if (!remove_file(path + '/' + entry.name))
|
|
||||||
{
|
{
|
||||||
return false;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (entry.is_directory == true)
|
if (entry.is_directory == false)
|
||||||
{
|
|
||||||
if (!remove_all(path + '/' + entry.name))
|
|
||||||
{
|
{
|
||||||
return false;
|
if (!remove_file(path + '/' + entry.name))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.is_directory == true)
|
||||||
|
{
|
||||||
|
if (!remove_all(path + '/' + entry.name))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (remove_root)
|
if (remove_root)
|
||||||
{
|
{
|
||||||
return remove_dir(path);
|
return remove_dir(path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue