From: wisberg Date: Fri, 9 May 2003 22:57:24 +0000 (+0000) Subject: Deleting temporary dir and config file, like harness -killTemp option (ignores -keepTemp) X-Git-Tag: V1_1_0_RC2~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0b4a9bbfe1153c5ae326b4d05292e21a89cb3f40;p=aspectj.git Deleting temporary dir and config file, like harness -killTemp option (ignores -keepTemp) --- diff --git a/testing/src/org/aspectj/testing/ajde/CompileCommand.java b/testing/src/org/aspectj/testing/ajde/CompileCommand.java index e9d75466a..a33ac06ce 100644 --- a/testing/src/org/aspectj/testing/ajde/CompileCommand.java +++ b/testing/src/org/aspectj/testing/ajde/CompileCommand.java @@ -38,6 +38,7 @@ public class CompileCommand implements ICommand { MyTaskListManager myHandler = new MyTaskListManager(); long endTime; boolean buildNextFresh; + File tempDir; /** * Clients call this before repeatCommand as a one-shot @@ -53,10 +54,14 @@ public class CompileCommand implements ICommand { setup(args); myHandler.start(); long startTime = System.currentTimeMillis(); - Ajde.getDefault().getBuildManager().buildFresh(); - // System.err.println("compiling " + Arrays.asList(args)); - waitForCompletion(startTime); - myHandler.finish(handler); + try { + Ajde.getDefault().getBuildManager().buildFresh(); + // System.err.println("compiling " + Arrays.asList(args)); + waitForCompletion(startTime); + } finally { + myHandler.finish(handler); + runCommandCleanup(); + } return !myHandler.hasError(); } @@ -74,6 +79,12 @@ public class CompileCommand implements ICommand { myHandler.finish(handler); return !myHandler.hasError(); } + void runCommandCleanup() { + if (null != tempDir) { + FileUtil.deleteContents(tempDir); + tempDir.delete(); + } + } // set by build progress monitor when done void setEndTime(long endTime) { @@ -145,7 +156,8 @@ public class CompileCommand implements ICommand { } private File writeConfig(String[] args) { - File result = new File(FileUtil.getTempDir("CompileCommand"), "config.lst"); + tempDir = FileUtil.getTempDir("CompileCommand"); + File result = new File(tempDir, "config.lst"); OutputStream out = null; try { out = new FileOutputStream(result);