mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
MSVC: Don't overwrite version.h if it hasn't changed
That avoids superfluous recompilation and linkage of project when nothing has changed.
This commit is contained in:
parent
42707caad6
commit
d16e6a7d49
@ -128,8 +128,9 @@ End Sub
|
||||
|
||||
' Output revision header file
|
||||
Sub OutputRevisionHeader(str)
|
||||
FSO.CopyFile rootFolder & "\\base\\internal_revision.h.in", targetFolder & "\\internal_revision.h"
|
||||
FindReplaceInFile targetFolder & "\\internal_revision.h", "@REVISION@", str
|
||||
FSO.CopyFile rootFolder & "\\base\\internal_revision.h.in", targetFolder & "\\internal_revision.h.tmp"
|
||||
FindReplaceInFile targetFolder & "\\internal_revision.h.tmp", "@REVISION@", str
|
||||
CompareFileAndReplace targetFolder & "\\internal_revision.h.tmp", targetFolder & "\\internal_revision.h"
|
||||
End Sub
|
||||
|
||||
Function DetermineTortoiseSVNVersion()
|
||||
@ -482,3 +483,20 @@ Sub FindReplaceInFile(filename, to_find, replacement)
|
||||
file.Write data
|
||||
file.Close
|
||||
End Sub
|
||||
|
||||
Sub CompareFileAndReplace(src_filename, dst_filename)
|
||||
Dim file, src_data, dst_data
|
||||
Set file = FSO.OpenTextFile(src_filename, 1, 0, 0)
|
||||
src_data = file.ReadAll
|
||||
file.Close
|
||||
Set file = FSO.OpenTextFile(dst_filename, 1, 0, 0)
|
||||
dst_data = file.ReadAll
|
||||
file.Close
|
||||
If StrComp(src_data, dst_data, vbBinaryCompare) = 0 Then
|
||||
' Files are the same, just remove the source
|
||||
FSO.DeleteFile src_filename
|
||||
Else
|
||||
' Files are different, overwrite the destination
|
||||
FSO.MoveFile src_filename, dst_filename
|
||||
End If
|
||||
End Sub
|
||||
|
Loading…
Reference in New Issue
Block a user