From 34a0c84476d23d14ddfea559276b2960b6c68c08 Mon Sep 17 00:00:00 2001 From: qouyang Date: Wed, 20 Sep 2006 06:21:04 +0000 Subject: [PATCH] Delete the midterm temporary file which created by GenFFSFile task. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1576 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/framework/tasks/Tool.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java index 0ef2a6ea7c..a7d28f5e7f 100644 --- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java +++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java @@ -34,6 +34,7 @@ public class Tool implements EfiDefine, Section { private String toolName = ""; private ToolArg toolArgList = new ToolArg(); private Input inputFiles = new Input(); + private Input tempInputFile = new Input(); private String outputPath; private File outputFile ; private List
gensectList = new ArrayList
(); @@ -93,6 +94,7 @@ public class Tool implements EfiDefine, Section { if (fs != null) { fs.close(); } + outputFile.delete(); } catch (Exception e) { EdkLog.log("WARNING: Cannot close " + outputFile.getPath()); } @@ -133,7 +135,7 @@ public class Tool implements EfiDefine, Section { throw new BuildException ("GenSection failed at Tool!"); } Do.close(); - this.inputFiles.insFile(outputFile.getPath()); + this.tempInputFile.insFile(outputFile.getPath()); } } catch (IOException e){ throw new BuildException ("Gensection failed at tool!"); @@ -142,13 +144,20 @@ public class Tool implements EfiDefine, Section { try { outputFile = File.createTempFile("temp", null, new File(outputPath)); argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ") - + " -o " + outputFile.getPath(); + + tempInputFile.toString(" ")+ " -o " + outputFile.getPath(); EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument); /// /// execute command line /// Process process = Runtime.getRuntime().exec(command + " " + argument); process.waitFor(); + Iterator tempFile = tempInputFile.getNameList().iterator(); + while (tempFile.hasNext()){ + File file = new File((String)tempFile.next()); + if (file.exists()) { + file.delete(); + } + } } catch (Exception e) { EdkLog.log(e.getMessage()); throw new BuildException("Execution of externalTool task failed!\n"); -- 2.39.2