List of usage examples for org.apache.commons.io FileUtils deleteDirectory
public static void deleteDirectory(File directory) throws IOException
From source file:de.jcup.egradle.sdk.builder.action.init.InitSDKTargetFolderAction.java
@Override public void execute(SDKBuilderContext context) throws IOException { /* delete old sdk */ if (context.targetPathDirectory.exists()) { System.out.println("Target directory exists - will be deleted before:" + context.targetPathDirectory.getCanonicalPath()); FileUtils.deleteDirectory(context.targetPathDirectory); }//from w w w . j a va 2 s . c o m context.targetPathDirectory.mkdirs(); }
From source file:ca.weblite.xmlvm.HarmonyBuilder.java
public void buildCodenameOne() throws IOException { org.apache.tools.ant.Project proj = new org.apache.tools.ant.Project(); proj.setBasedir(new File(".").getAbsolutePath()); setProject(proj);//from w w w . j ava 2s . com File buildDir = new File(proj.getBaseDir(), "build"); File classesDir = new File(buildDir, "cn1Build"); if (classesDir.exists()) { FileUtils.deleteDirectory(classesDir); } classesDir.mkdir(); File cDir = new File(buildDir, "c"); if (cDir.exists()) { FileUtils.deleteDirectory(cDir); } cDir.mkdir(); File cn1SourceDir = new File(codenameOneDir, "CodenameOne/src"); File cn1PortDir = new File(codenameOneDir, "Ports/iOSPort/src"); Path javaSourcesPath = new Path(proj, cn1SourceDir.getAbsolutePath()); javaSourcesPath.add(new Path(proj, cn1PortDir.getAbsolutePath())); Javac javac = (Javac) proj.createTask("javac"); javac.setSrcdir(javaSourcesPath); javac.setDestdir(classesDir); javac.setTarget("1.5"); javac.execute(); //xmlvm.setClassPath(new Path(proj, harmonyDir.getAbsolutePath())); runXmlvm(new String[] { //"-XmX=2G", "--in=" + classesDir.getAbsolutePath(), "--out=" + cDir.getAbsolutePath(), "--target=c", "--load-dependencies", "--disable-vtable-optimizations", "--c-source-extension=m" }); ConstantPoolHelper.removeConstantPoolDependencies(cDir); VtableHelper.fixVtableReferences(proj, cDir, cDir); }
From source file:com.carrotgarden.maven.scr.CarrotOsgiScrClean.java
/** * {@inheritDoc}// w w w . j av a 2 s .c o m */ @Override public void execute() throws MojoFailureException { try { contextMessageClear(pomFile()); logInfo("clean"); logInfo("incremental: " + isContextIncremental()); if (!isProperPackaging()) { logInfo("skip for packaging=" + project.getPackaging()); return; } final File folder = outputDirectorySCR(); logDebug(""); if (folder.exists()) { logDebug("folder deleted : " + folder); FileUtils.deleteDirectory(folder); } } catch (final Throwable e) { final String message = "clean failure: " + e; logError(message); contextMessageError(pomFile(), message, e); throw new MojoFailureException("bada-boom", e); } }
From source file:com.splout.db.engine.TestRedisManager.java
@Before public void prepare() throws IOException { File file = new File(TEST_FOLDER); if (file.exists()) FileUtils.deleteDirectory(file); file.mkdir();//from w ww . jav a 2 s . c o m }
From source file:com.blackberry.bdp.test.utils.LocalKafkaServer.java
public LocalKafkaServer() throws IOException { while (new File(logDir).exists()) { FileUtils.deleteDirectory(new File(logDir)); }/*w ww . ja v a 2s .c o m*/ Properties props = new Properties(); props.put("broker.id", nodeId); props.put("port", port); props.put("log.dir", logDir); props.put("zookeeper.connect", zkConnect); props.put("host.name", "127.0.0.1"); KafkaConfig conf = new KafkaConfig(props); server = new KafkaServerStartable(conf); server.startup(); }
From source file:com.mammothdata.samplepipeline.ApplicationTest.java
@Before public void beforeTest() throws Exception { kafkaLauncher.baseDir = "target/kafka/" + this.getClass().getName(); FileUtils.deleteDirectory(new File(kafkaLauncher.baseDir)); kafkaLauncher.startZookeeper();/* ww w. j a v a 2 s .c o m*/ kafkaLauncher.startKafkaServer(); kafkaLauncher.createTopic(0, TOPIC); // File baseDir = new File("target/hdfs/" + this.getClass().getName()); // FileUtil.fullyDelete(baseDir); // System.out.println("MiniDFSCluster.HDFS_MINIDFS_BASEDIR: " + MiniDFSCluster.HDFS_MINIDFS_BASEDIR); // System.out.println("baseDir.getPath(): " + baseDir.getPath()); // conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getPath()); // MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf); // hdfsCluster = builder.build(); }
From source file:com.fizzed.blaze.jdk.BlazeJdkEngineTest.java
@BeforeClass static public void clearCache() throws IOException { Context context = new ContextImpl(null, Paths.get(System.getProperty("user.home")), null, null); Path classesDir = ConfigHelper.userBlazeEngineDir(context, "java"); FileUtils.deleteDirectory(classesDir.toFile()); }
From source file:ch.unibas.fittingwizard.application.base.MoleculesDir.java
/** * Delets a molecule from the molecule directory. * @param name/*from w w w .j a va2s.co m*/ */ public void deleteMolecule(String name) { File molDir = new File(directory, name); try { FileUtils.deleteDirectory(molDir); } catch (IOException e) { throw new RuntimeException("Could not delete existing molecule directory " + molDir.getAbsolutePath()); } }
From source file:com.heliosdecompiler.helios.utils.APKTool.java
public static void decodeResources(File input, File output) { try {//from w ww . ja va2 s . c o m Path temporaryDirectory = Files.createTempDirectory("apkresources"); File directory = temporaryDirectory.toFile(); Files.delete(temporaryDirectory); cmdDecode(input, directory); File original = new File(directory, "original"); FileUtils.deleteDirectory(original); File apktool = new File(directory, "apktool.yml"); apktool.delete(); ZipUtil.pack(directory, output); FileUtils.deleteDirectory(directory); } catch (Exception e) { ExceptionHandler.handle(e); } }
From source file:com.gs.obevo.db.impl.platforms.db2.Db2lookRevengTest.java
@Test public void testReveng() throws Exception { File outputDir = new File("./target/db2revengoutput"); FileUtils.deleteDirectory(outputDir); AquaRevengArgs args = new AquaRevengArgs(); args.setDbSchema(SCHEMA);/*from www . j a va 2 s . c om*/ args.setInputPath(new File("./src/test/resources/reveng/db2look/input/db2input.txt")); args.setGenerateBaseline(false); args.setOutputPath(outputDir); new Db2lookReveng().reveng(args); DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/db2look/expected"), outputDir); }