/** Shutdown and cleanup the temporary directory and removes any shutdown hooks in use. */ @Deprecated public static synchronized void shutdown() { if (defaultTempDir != null && defaultTempDir.exists()) { removeDir(defaultTempDir); } if (shutdownHook != null) { Runtime.getRuntime().removeShutdownHook(shutdownHook); shutdownHook = null; } }
public static void removeDir(File d) { String[] list = d.list(); if (list == null) { list = new String[0]; } for (String s : list) { File f = new File(d, s); if (f.isDirectory()) { removeDir(f); } else { delete(f); } } delete(d); }