Skip to content

Commit

Permalink
修复deleteEmptyDir相关bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-chu committed Dec 2, 2023
1 parent e7cd1f3 commit 7a40327
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Util/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,13 @@ static bool isEmptyDir(const std::string &path) {
}

void File::deleteEmptyDir(const std::string &dir, bool backtrace) {
if (File::is_dir(dir) || !isEmptyDir(dir)) {
if (!File::is_dir(dir) || !isEmptyDir(dir)) {
// 不是文件夹或者非空
return;
}
File::delete_file(dir);
if (backtrace) {
auto parent = File::parentDir(dir);
deleteEmptyDir(parent, backtrace);
deleteEmptyDir(File::parentDir(dir), true);
}
}

Expand Down

0 comments on commit 7a40327

Please sign in to comment.