I’m stuck with the fact that no folder is made.
private static File createNewTempDir() {
File baseDir = new File(System.getProperty("java.io.tmpdir"));
String baseNamePrefix = System.currentTimeMillis() + "_" + Math.random() + "-";
LOG.info(System.getProperty("java.io.tmpdir"));
File tempDir = new File(baseDir, baseNamePrefix + "0");
LOG.info(tempDir.getAbsolutePath());
tempDir.mkdirs();
if (tempDir.exists()) {
LOG.info("I would be happy!");
}
else {
LOG.info("No folder there");
}
return tempDir;
}
Is there any wrong with it? I can get the LOG that no folders are there…
Your code is fine, but your conditional is wrong:
The folder is created indeed, you can check that by getting the path and opening on Explorer.
EDIT: It works on Windows at least. I cleaned it up a bit:
Output: