Changeset - r16616:cd3b5f6a975b
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-11-30 12:02:19
rubidium@openttd.org
(svn r21356) -Fix (r21351): sometimes versions wouldn't be correctly set for Windows builds
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
projects/determineversion.vbs
Show inline comments
 
@@ -77,25 +77,25 @@ Function ReadRegistryKey(shive, subkey, 
 
	End Select
 

	
 
	Set Inparams = objReg.Methods_("GetStringValue").Inparameters
 
	Inparams.Hdefkey = hiveKey
 
	Inparams.Ssubkeyname = subkey
 
	Inparams.Svaluename = valuename
 
	Set Outparams = objReg.ExecMethod_("GetStringValue", Inparams,,objCtx)
 

	
 
	ReadRegistryKey = Outparams.SValue
 
End Function
 

	
 
Function DetermineSVNVersion()
 
	Dim WshShell, version, branch, modified, revision, url, oExec, line, hash
 
	Dim WshShell, version, branch, modified, revision, clean_rev, url, oExec, line, hash
 
	Set WshShell = CreateObject("WScript.Shell")
 
	On Error Resume Next
 

	
 
	revision = 0
 

	
 
	' Try TortoiseSVN
 
	' Get the directory where TortoiseSVN (should) reside(s)
 
	Dim sTortoise
 
	' First, try with 32-bit architecture
 
	sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 32)
 
	If sTortoise = "" Or IsNull(sTortoise) Then
 
		' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
 
@@ -252,45 +252,45 @@ Function DetermineSVNVersion()
 

	
 
						Set oExec = WshShell.Exec("hg log -f -k " & Chr(34) & "(svn r" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc}\n" & Chr(34) & " --cwd ../")
 
						If Err.Number = 0 Then
 
							revision = Mid(OExec.StdOut.ReadLine(), 7)
 
							revision = Mid(revision, 1, InStr(revision, ")") - 1)
 
						End If ' Err.Number = 0
 
					End If ' Err.Number = 0
 
				End If ' oExec.ExitCode = 0
 
			End If ' Err.Number = 0
 
		End If ' version = "norev000"
 
	End If ' version <> "norev000"
 

	
 
	Dim rev_file
 
	Set rev_file = FSO.OpenTextFile("../.ottdrev", 1, True, 0)
 
	If Not rev_file.atEndOfStream Then
 
	If version = "norev000" And FSO.FileExists("../.ottdrev") Then
 
		Dim rev_file
 
		Set rev_file = FSO.OpenTextFile("../.ottdrev", 1, True, 0)
 
		DetermineSVNVersion = rev_file.ReadLine()
 
		rev_file.Close()
 
	Else
 
		If modified = 2 Then
 
			version = version & "M"
 
		End If
 

	
 
		clean_rev = version
 
		If branch <> "" Then
 
			version = version & "-" & branch
 
		End If
 

	
 
		If version <> "norev000" Then
 
			DetermineSVNVersion = version & Chr(9) & revision & Chr(9) & modified & Chr(9) & clean_rev
 
		Else
 
			DetermineSVNVersion = version
 
		End If
 
	End If
 
	rev_file.close
 
End Function
 

	
 
Function IsCachedVersion(ByVal version)
 
	Dim cache_file, cached_version
 
	cached_version = ""
 
	Set cache_file = FSO.OpenTextFile("../config.cache.version", 1, True, 0)
 
	If Not cache_file.atEndOfStream Then
 
		cached_version = cache_file.ReadLine()
 
	End If
 
	cache_file.Close
 

	
 
	If InStr(version, Chr(9)) Then
0 comments (0 inline, 0 general)