File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
src/main/java/com/openkm/util Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 3131import org .slf4j .LoggerFactory ;
3232
3333import java .io .*;
34+ import java .nio .file .Files ;
3435import java .text .SimpleDateFormat ;
3536import java .util .Collection ;
3637import java .util .Date ;
@@ -66,13 +67,7 @@ public static String getFileExtension(String file) {
6667 * @throws IOException If something fails.
6768 */
6869 public static File createTempDir () throws IOException {
69- File tmpFile = File .createTempFile ("okm" , null );
70-
71- if (!tmpFile .delete ())
72- throw new IOException ();
73- if (!tmpFile .mkdir ())
74- throw new IOException ();
75- return tmpFile ;
70+ return Files .createTempDirectory ("okm" ).toFile ();
7671 }
7772
7873 /**
@@ -229,7 +224,7 @@ public static void copy(File input, File output) throws IOException {
229224 }
230225
231226 /**
232- * Create "year / month / day" directory structure.
227+ * Create "year / month / day" directory structure.
233228 */
234229 public static File createDateDir (String parent ) {
235230 SimpleDateFormat sdf = new SimpleDateFormat ("yyyy" + File .separator + "MM" + File .separator + "dd" );
You can’t perform that action at this time.
0 commit comments