mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-07 16:57:50 +01:00
Stop giving up immediately on the first failed file deletion and continue deleting files recursively.
This commit is contained in:
parent
2e4b814d6d
commit
da54f9769b
@ -25,19 +25,16 @@ public class FileUtils {
|
||||
*/
|
||||
public static boolean deleteFolder(File file) {
|
||||
if (file.exists()) {
|
||||
boolean ret = true;
|
||||
// If the file exists, and it has more than one file in it.
|
||||
if (file.isDirectory()) {
|
||||
for (File f : file.listFiles()) {
|
||||
if (!FileUtils.deleteFolder(f)) {
|
||||
return false;
|
||||
}
|
||||
ret = ret && deleteFolder(f);
|
||||
}
|
||||
}
|
||||
file.delete();
|
||||
return !file.exists();
|
||||
return ret && file.delete();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user