/** * Delete all files and folders under the temporary folder. * Usually not called directly, since it is automatically done via deleteOnExit(). */ public void delete() { recursiveDelete(folder); }
if (injector == null) { configuration = conf; configuration.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder("data").getAbsolutePath()); configuration.set(Constants.AppFabric.REST_PORT, Integer.toString(Networks.getRandomPort())); configuration.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET, true);
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }