Changeset - r16420:ec4391c451c4
[Not reviewed]
master
0 1 0
glx - 14 years ago 2010-11-11 17:06:33
glx@openttd.org
(svn r21146) -Fix [FS#4212]: make sure to be upgraded openttd is not running when installing (Win32)
1 file changed with 20 insertions and 1 deletions:
0 comments (0 inline, 0 general)
os/windows/installer/install.nsi
Show inline comments
 
@@ -99,12 +99,15 @@ Page custom SelectCDEnter SelectCDExit "
 
!insertmacro MUI_LANGUAGE "English"
 
!insertmacro MUI_RESERVEFILE_LANGDLL
 

	
 
;--------------------------------------------------------------
 
; (Core) OpenTTD install section. Copies all internal game data
 
Section "!OpenTTD" Section1
 
	; Make sure to be upgraded OpenTTD is not running
 
	Call CheckOpenTTDRunning
 

	
 
	; Overwrite files by default, but don't complain on failure
 
	SetOverwrite try
 

	
 
	; Define root variable relative to installer
 
	!define PATH_ROOT "..\..\..\"
 

	
 
@@ -514,13 +517,12 @@ Win64:
 
	GoTo Done
 
Abort:
 
	Quit
 
Done:
 
FunctionEnd
 

	
 

	
 
;-------------------------------------------------------------------------------
 
; Check whether we're not running an installer for NT on 9x and vice versa
 
Function CheckWindowsVersion
 
	Call GetWindowsVersion
 
	Pop $R0
 
	StrCmp $R0 "win9x" 0 WinNT
 
@@ -534,12 +536,29 @@ WinNT:
 
	MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You are trying to install the Windows 95, 98 and ME version on Windows 2000, XP or Vista. This is not advised, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort
 
Abort:
 
	Quit
 
Done:
 
FunctionEnd
 

	
 
;-------------------------------------------------------------------------------
 
; Check whether OpenTTD is running
 
Function CheckOpenTTDRunning
 
	IfFileExists "$INSTDIR\openttd.exe" 0 Done
 
Retry:
 
	FindProcDLL::FindProc "openttd.exe"
 
	Pop $R0
 
	IntCmp $R0 1 0 Done
 
	ClearErrors
 
	Delete "$INSTDIR\openttd.exe"
 
	IfErrors 0 Done
 
	ClearErrors
 
	MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "OpenTTD is running. Please close it and retry." IDRETRY Retry
 
	Abort
 
Done:
 
FunctionEnd
 

	
 
Var OLDVERSION
 
Var UninstallString
 

	
 
;-----------------------------------------------------------------------------------
 
; NSIS Initialize function, determine if we are going to install/upgrade or uninstall
 
Function .onInit
0 comments (0 inline, 0 general)