1 19 20 package org.netbeans.lib.cvsclient; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 25 30 public class TestKit { 31 public static File createTmpFolder(String prefix) throws IOException { 32 String tmpDir = System.getProperty("java.io.tmpdir"); File tmpFolder = new File (tmpDir); 34 File tmp = File.createTempFile(prefix, "", tmpFolder); if (tmp.delete() == false) { 37 throw new IOException ("Can not delete " + tmp); 38 }; 39 if (tmp.mkdirs() == false) { 40 throw new IOException ("Can not create " + tmp); 41 }; 42 return tmp; 43 } 44 45 public static void deleteRecursively(File file) { 46 if (file.isDirectory()) { 47 File [] files = file.listFiles(); 48 for (int i = 0; i < files.length; i++) { 49 File next = files[i]; 50 deleteRecursively(next); } 52 file.delete(); 53 } 54 } 55 } 56 | Popular Tags |