]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
Delete the midterm temporary file which created by GenFFSFile task.
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / Tool.java
index 0ef2a6ea7c22941d7bbb7709e49a7cd2ccc443bd..a7d28f5e7f9e7578248553c7cb7bf81061225ce2 100644 (file)
@@ -34,6 +34,7 @@ public class Tool implements EfiDefine, Section {
     private String toolName     = "";\r
     private ToolArg toolArgList = new ToolArg();\r
     private Input inputFiles = new Input();\r
+    private Input tempInputFile = new Input();\r
     private String outputPath;\r
     private File outputFile ;\r
     private List<Section>  gensectList = new ArrayList<Section>();\r
@@ -93,6 +94,7 @@ public class Tool implements EfiDefine, Section {
                 if (fs != null) {\r
                     fs.close();\r
                 }\r
+                outputFile.delete(); \r
             } catch (Exception e) {\r
                 EdkLog.log("WARNING: Cannot close " + outputFile.getPath());\r
             }\r
@@ -133,7 +135,7 @@ public class Tool implements EfiDefine, Section {
                     throw new BuildException ("GenSection failed at Tool!");\r
                 }  \r
                 Do.close();\r
-                this.inputFiles.insFile(outputFile.getPath());                        \r
+                this.tempInputFile.insFile(outputFile.getPath());\r
             }        \r
         } catch (IOException e){\r
             throw new BuildException ("Gensection failed at tool!");\r
@@ -142,13 +144,20 @@ public class Tool implements EfiDefine, Section {
         try {\r
             outputFile = File.createTempFile("temp", null, new File(outputPath));\r
             argument   = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ") \r
-                         + " -o " + outputFile.getPath();\r
+                         + tempInputFile.toString(" ")+ " -o " + outputFile.getPath();\r
             EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);\r
             ///\r
             /// execute command line\r
             ///\r
             Process process = Runtime.getRuntime().exec(command + " " + argument);\r
             process.waitFor();\r
+            Iterator tempFile = tempInputFile.getNameList().iterator();\r
+            while (tempFile.hasNext()){\r
+                File file = new File((String)tempFile.next());\r
+                if (file.exists()) {\r
+                    file.delete();\r
+                }\r
+            }\r
         } catch (Exception e) {\r
             EdkLog.log(e.getMessage());\r
             throw new BuildException("Execution of externalTool task failed!\n");\r