Add check when copy flashMap.h to ${ModuleOutputDir}/Debug/TianoR8FlashMap.h.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1065 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qouyang 2006-07-21 08:26:32 +00:00
parent f9d0ab9266
commit 31a9215c32
1 changed files with 19 additions and 15 deletions

View File

@ -2060,21 +2060,25 @@ public class AutoGen {
int size = (int)inFile.length(); int size = (int)inFile.length();
byte[] buffer = new byte[size]; byte[] buffer = new byte[size];
File outFile = new File (this.outputPath + File.separatorChar + CommonDefinition.tianoR8FlashMapH); File outFile = new File (this.outputPath + File.separatorChar + CommonDefinition.tianoR8FlashMapH);
try{ //
if (inFile.exists()) { // If TianoR8FlashMap.h existed and the flashMap.h don't change,
FileInputStream fis = new FileInputStream (inFile); // do nothing.
fis.read(buffer); //
FileOutputStream fos = new FileOutputStream(outFile); if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {
fos.write(buffer); try{
fis.close(); if (inFile.exists()) {
fos.close(); FileInputStream fis = new FileInputStream (inFile);
}else { fis.read(buffer);
throw new AutoGenException("The flashMap.h file don't exist!!"); FileOutputStream fos = new FileOutputStream(outFile);
fos.write(buffer);
fis.close();
fos.close();
}else {
throw new AutoGenException("The flashMap.h file don't exist!!");
}
} catch (Exception e){
throw new AutoGenException(e.getMessage());
} }
} catch (Exception e){ }
throw new AutoGenException(e.getMessage());
}
} }
} }