revert nsis changes

This commit is contained in:
tooomm 2026-09-09 23:34:36 +02:00
parent c892f7fc46
commit 5d65adfc9c

View file

@ -64,6 +64,14 @@ ${If} ${NSIS_IS_64_BIT} == 1 # NSIS 64bit
${EndIf} ${EndIf}
StrCpy $NormalDestDir "$ProgramFiles64\Cockatrice" StrCpy $NormalDestDir "$ProgramFiles64\Cockatrice"
SetRegView 64 SetRegView 64
${Else} #NSIS 32bit
${If} ${RunningX64}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"You are about to install a 32-bit version of Cockatrice on a 64-bit Windows system.$\n\
We advise you to use the correct 64-bit installer instead to get around potential issues.$\n$\n\
Download from our webpage: https://cockatrice.github.io"
${EndIf}
StrCpy $NormalDestDir "$ProgramFiles\Cockatrice"
${EndIf} ${EndIf}
StrCpy $PortableDestDir "$Desktop\CockatricePortable" StrCpy $PortableDestDir "$Desktop\CockatricePortable"
@ -148,6 +156,7 @@ ${If} $8 != "admin"
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Function SetModeDestinationFromInstdir Function SetModeDestinationFromInstdir
${If} $PortableMode = 0 ${If} $PortableMode = 0
StrCpy $NormalDestDir $InstDir StrCpy $NormalDestDir $InstDir
@ -166,14 +175,27 @@ Function AutoUninstallIfNeeded
SetShellVarContext all SetShellVarContext all
; --- 32-bit uninstall ---
SetRegView 32
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString"
StrCmp $R0 "" done32
DetailPrint "Removing previous version (32-bit)..."
ExecWait '$R0'
done32:
; --- 64-bit uninstall ---
${If} ${RunningX64}
SetRegView 64 SetRegView 64
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString"
StrCmp $R0 "" done64 StrCmp $R0 "" done64
DetailPrint "Removing previous version..." DetailPrint "Removing previous version (64-bit)..."
ExecWait '$R0' ExecWait '$R0'
done64: done64:
${EndIf}
FunctionEnd FunctionEnd
@ -222,6 +244,27 @@ ${EndIf}
${If} $PortableMode = 0 ${If} $PortableMode = 0
SetShellVarContext all SetShellVarContext all
# uninstall 32bit version
SetRegView 32
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString"
StrCmp $R0 "" done32
${If} $ReinstallMode = 0
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst32
Abort
${Else}
Goto uninst32
${EndIf}
uninst32:
ClearErrors
ExecWait "$R0"
done32:
# uninstall 64bit version
${If} ${NSIS_IS_64_BIT} == 1
SetRegView 64 SetRegView 64
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString"
@ -239,6 +282,7 @@ ${If} $PortableMode = 0
ExecWait "$R0" ExecWait "$R0"
done64: done64:
${EndIf}
${Else} ${Else}
Abort Abort
@ -301,6 +345,14 @@ ${If} $PortableMode = 0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@"
IfFileExists "$INSTDIR\vc_redist.x86.exe" VcRedist86Exists PastVcRedist86Check
VcRedist86Exists:
ExecWait '"$INSTDIR\vc_redist.x86.exe" /passive /norestart'
DetailPrint "Wait to ensure unlock of vc_redist file after installation..."
Sleep 3000
Delete "$INSTDIR\vc_redist.x86.exe"
PastVcRedist86Check:
IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check
VcRedist64Exists: VcRedist64Exists:
ExecWait '"$INSTDIR\vc_redist.x64.exe" /passive /norestart' ExecWait '"$INSTDIR\vc_redist.x64.exe" /passive /norestart'