mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Merge remote-tracking branch 'ignite/master'
This commit is contained in:
commit
1edc00b334
1 changed files with 21 additions and 0 deletions
|
@ -31,6 +31,7 @@ import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Stack;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@ -155,4 +156,24 @@ public final class FileUtils {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void deleteDirectory(File root) {
|
||||||
|
File[] currList;
|
||||||
|
Stack<File> stack = new Stack<>();
|
||||||
|
stack.push(root);
|
||||||
|
while (!stack.isEmpty()) {
|
||||||
|
if (stack.lastElement().isDirectory()) {
|
||||||
|
currList = stack.lastElement().listFiles();
|
||||||
|
if (currList != null && currList.length > 0) {
|
||||||
|
for (File curr : currList) {
|
||||||
|
stack.push(curr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stack.pop().delete();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stack.pop().delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue