mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-12 02:29:38 +02:00
Refactor API
This commit is contained in:
parent
e23cf88082
commit
ffbfae9856
14 changed files with 521 additions and 138 deletions
|
@ -158,6 +158,9 @@ public final class FileUtils {
|
|||
}
|
||||
|
||||
public static void deleteDirectory(File root) {
|
||||
if (!root.exists()) {
|
||||
return;
|
||||
}
|
||||
File[] currList;
|
||||
Stack<File> stack = new Stack<>();
|
||||
stack.push(root);
|
||||
|
@ -176,4 +179,25 @@ public final class FileUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link File} pointing to a temporary directory. On unix like systems this might be {@code /tmp}
|
||||
* for example.
|
||||
* If {@code suffix} is not null, the returned file points to {@code <temp>/suffix}.
|
||||
*
|
||||
* @param suffix optional path suffix
|
||||
* @return temp directory
|
||||
*/
|
||||
public static File getTempDir(String suffix) {
|
||||
String temp = System.getProperty("java.io.tmpdir");
|
||||
if (temp == null) {
|
||||
temp = "tmp";
|
||||
}
|
||||
|
||||
if (suffix == null) {
|
||||
return new File(temp);
|
||||
} else {
|
||||
return new File(temp, suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue