public ZipService() { SystemInstance.get().setComponent(ZipService.class, this); File tempFolderMutable = new File(System.getProperty("openejb.base", ""), "work"); if (!tempFolderMutable.isDirectory()) { tempFolderMutable = new File(System.getProperty("java.io.tmpdir"), ZipService.class.getName() + "_" + System.nanoTime()); Files.mkdirs(tempFolderMutable); Files.deleteOnExit(tempFolderMutable); } // use a subfolder of work one tmpFolder = Files.mkdirs(new File(tempFolderMutable, ZipService.class.getName())); }
public static File tmpdir() { try { File file = null; try { file = File.createTempFile("temp", "dir"); } catch (final Throwable e) { //Use a local tmp directory final File tmp = new File("tmp"); if (!tmp.exists() && !tmp.mkdirs()) { throw new IOException("Failed to create local tmp directory: " + tmp.getAbsolutePath()); } file = File.createTempFile("temp", "dir", tmp); } if (!file.delete()) { throw new IOException("Failed to create temp dir. Delete failed"); } mkdir(file); deleteOnExit(file); return file; } catch (final IOException e) { throw new FileRuntimeException(e); } }
public static File tmpdir() { try { File file; try { file = File.createTempFile("temp", "dir"); } catch (final Throwable e) { //Use a local tmp directory final File tmp = new File("tmp"); hackJDK4715154(); if (!tmp.exists() && !tmp.mkdirs()) { throw new IOException("Failed to create local tmp directory: " + tmp.getAbsolutePath()); } file = File.createTempFile("temp", "dir", tmp); } hackJDK4715154(); if (!file.delete()) { throw new IOException("Failed to create temp dir. Delete failed"); } mkdir(file); deleteOnExit(file); return file; } catch (final IOException e) { throw new FileRuntimeException(e); } }
Files.deleteOnExit(destinationDir); final File pf = destinationDir.getParentFile(); final String name = destinationDir.getName() + System.currentTimeMillis(); destinationDir = new File(pf, name); destinationDir.deleteOnExit(); Files.deleteOnExit(destinationDir);
Files.deleteOnExit(destinationDir); final File pf = destinationDir.getParentFile(); final String name = destinationDir.getName() + System.currentTimeMillis(); destinationDir = new File(pf, name); destinationDir.deleteOnExit(); Files.deleteOnExit(destinationDir);