From 0b4a9bbfe1153c5ae326b4d05292e21a89cb3f40 Mon Sep 17 00:00:00 2001 From: wisberg Date: Fri, 9 May 2003 22:57:24 +0000 Subject: [PATCH] Deleting temporary dir and config file, like harness -killTemp option (ignores -keepTemp) --- .../aspectj/testing/ajde/CompileCommand.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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); -- 2.39.5