diff options
author | Le Philousophe | 2019-07-03 20:20:07 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-20 11:18:18 +0200 |
commit | d16e6a7d4968b4564b369c895e956a5ede38bf81 (patch) | |
tree | 4f05dbb29ddc569a66d5830a1af8c4dbb115e10f /devtools | |
parent | 42707caad6bbf7264ee4678a4c9daf1795ad5029 (diff) | |
download | scummvm-rg350-d16e6a7d4968b4564b369c895e956a5ede38bf81.tar.gz scummvm-rg350-d16e6a7d4968b4564b369c895e956a5ede38bf81.tar.bz2 scummvm-rg350-d16e6a7d4968b4564b369c895e956a5ede38bf81.zip |
MSVC: Don't overwrite version.h if it hasn't changed
That avoids superfluous recompilation and linkage of project when nothing
has changed.
Diffstat (limited to 'devtools')
-rw-r--r-- | devtools/create_project/scripts/revision.vbs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/devtools/create_project/scripts/revision.vbs b/devtools/create_project/scripts/revision.vbs index e6fef57030..b8c2d6121f 100644 --- a/devtools/create_project/scripts/revision.vbs +++ b/devtools/create_project/scripts/revision.vbs @@ -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 |