projects/determineversion.vbs
changeset 7780 12ef69de4e60
parent 7565 a7ce188ec44e
child 7784 94d15bc396ce
equal deleted inserted replaced
7779:fa1586b64dc8 7780:12ef69de4e60
    12 	Set file = FSO.CreateTextFile(FileName, -1, 0)
    12 	Set file = FSO.CreateTextFile(FileName, -1, 0)
    13 	file.Write data
    13 	file.Write data
    14 	file.Close
    14 	file.Close
    15 End Sub
    15 End Sub
    16 
    16 
    17 Sub UpdateFile(version, cur_date, filename)
    17 Sub UpdateFile(revision, version, cur_date, filename)
    18 	FSO.CopyFile filename & ".in", filename
    18 	FSO.CopyFile filename & ".in", filename
       
    19 	FindReplaceInFile filename, "@@REVISION@@", revision
    19 	FindReplaceInFile filename, "@@VERSION@@", version
    20 	FindReplaceInFile filename, "@@VERSION@@", version
    20 	FindReplaceInFile filename, "@@DATE@@", cur_date
    21 	FindReplaceInFile filename, "@@DATE@@", cur_date
    21 End Sub
    22 End Sub
    22 
    23 
    23 Sub UpdateFiles(version)
    24 Sub UpdateFiles(version)
    24 	Dim cur_date
    25 	Dim cur_date
    25 	cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
    26 	cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
    26 	UpdateFile version, cur_date, "../src/rev.cpp"
    27 	Dim revision
    27 	UpdateFile version, cur_date, "../src/ottdres.rc"
    28 	If version = "norev000" Then
       
    29 		revision = 0
       
    30 	Else
       
    31 		revision = Mid(version, 2)
       
    32 		If InStr(revision, "M") Then
       
    33 			revision = Mid(revision, 1, InStr(revision, "M") - 1)
       
    34 		End If
       
    35 		If InStr(revision, "-") Then
       
    36 			revision = Mid(revision, 1, InStr(revision, "-") - 1)
       
    37 		End If
       
    38 	End If
       
    39 
       
    40 	UpdateFile revision, version, cur_date, "../src/rev.cpp"
       
    41 	UpdateFile revision, version, cur_date, "../src/ottdres.rc"
    28 End Sub
    42 End Sub
    29 
    43 
    30 Function DetermineSVNVersion()
    44 Function DetermineSVNVersion()
    31 	Dim WshShell, version, url, oExec
    45 	Dim WshShell, version, url, oExec
    32 	Set WshShell = CreateObject("WScript.Shell")
    46 	Set WshShell = CreateObject("WScript.Shell")