Delete the midterm temporary file which created by GenFFSFile task.
authorqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 20 Sep 2006 06:21:04 +0000 (06:21 +0000)
committerqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 20 Sep 2006 06:21:04 +0000 (06:21 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1576 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java

index 0ef2a6e..a7d28f5 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 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
     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
                 if (fs != null) {\r
                     fs.close();\r
                 }\r
+                outputFile.delete(); \r
             } catch (Exception e) {\r
                 EdkLog.log("WARNING: Cannot close " + outputFile.getPath());\r
             }\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
                     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
             }        \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
         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
             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
         } catch (Exception e) {\r
             EdkLog.log(e.getMessage());\r
             throw new BuildException("Execution of externalTool task failed!\n");\r