/** * Cleans up temporary files. */ public void cleanUp() { this.jythonJarFile = null; this.xbayaJarFile = null; if (this.tmpJarDirectory != null) { try { IOUtil.deleteDirectory(this.tmpJarDirectory); } catch (RuntimeException e) { logger.error(e.getMessage(), e); } } }
/** * @param path * @return <code>true</code> if and only if the file or directory is successfully deleted; <code>false</code> * otherwise */ public static boolean deleteDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); for (File file : files) { if (file.isDirectory()) { deleteDirectory(file); } else { file.delete(); } } } return path.delete(); }
/** * @param path * @return <code>true</code> if and only if the file or directory is successfully deleted; <code>false</code> * otherwise */ public static boolean deleteDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); for (File file : files) { if (file.isDirectory()) { deleteDirectory(file); } else { file.delete(); } } } return path.delete(); }