From: qouyang Date: Wed, 20 Sep 2006 06:21:04 +0000 (+0000) Subject: Delete the midterm temporary file which created by GenFFSFile task. X-Git-Tag: edk2-stable201903~24298 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=34a0c84476d23d14ddfea559276b2960b6c68c08 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 --- 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");