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
This commit is contained in:
qouyang 2006-09-20 06:21:04 +00:00
parent 76c86b3ac4
commit 34a0c84476
1 changed files with 11 additions and 2 deletions

View File

@ -34,6 +34,7 @@ public class Tool implements EfiDefine, Section {
private String toolName = ""; private String toolName = "";
private ToolArg toolArgList = new ToolArg(); private ToolArg toolArgList = new ToolArg();
private Input inputFiles = new Input(); private Input inputFiles = new Input();
private Input tempInputFile = new Input();
private String outputPath; private String outputPath;
private File outputFile ; private File outputFile ;
private List<Section> gensectList = new ArrayList<Section>(); private List<Section> gensectList = new ArrayList<Section>();
@ -93,6 +94,7 @@ public class Tool implements EfiDefine, Section {
if (fs != null) { if (fs != null) {
fs.close(); fs.close();
} }
outputFile.delete();
} catch (Exception e) { } catch (Exception e) {
EdkLog.log("WARNING: Cannot close " + outputFile.getPath()); EdkLog.log("WARNING: Cannot close " + outputFile.getPath());
} }
@ -133,7 +135,7 @@ public class Tool implements EfiDefine, Section {
throw new BuildException ("GenSection failed at Tool!"); throw new BuildException ("GenSection failed at Tool!");
} }
Do.close(); Do.close();
this.inputFiles.insFile(outputFile.getPath()); this.tempInputFile.insFile(outputFile.getPath());
} }
} catch (IOException e){ } catch (IOException e){
throw new BuildException ("Gensection failed at tool!"); throw new BuildException ("Gensection failed at tool!");
@ -142,13 +144,20 @@ public class Tool implements EfiDefine, Section {
try { try {
outputFile = File.createTempFile("temp", null, new File(outputPath)); outputFile = File.createTempFile("temp", null, new File(outputPath));
argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ") argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ")
+ " -o " + outputFile.getPath(); + tempInputFile.toString(" ")+ " -o " + outputFile.getPath();
EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument); EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
/// ///
/// execute command line /// execute command line
/// ///
Process process = Runtime.getRuntime().exec(command + " " + argument); Process process = Runtime.getRuntime().exec(command + " " + argument);
process.waitFor(); 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) { } catch (Exception e) {
EdkLog.log(e.getMessage()); EdkLog.log(e.getMessage());
throw new BuildException("Execution of externalTool task failed!\n"); throw new BuildException("Execution of externalTool task failed!\n");