Skip to content

Commit

Permalink
Don't ask to download JRE7 if JRE6 is installed for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
taconaut committed Apr 3, 2012
1 parent 03f2ebd commit ff82c79
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/external-resources/nsis/pms.nsi
Expand Up @@ -23,8 +23,9 @@ VIProductVersion "${PROJECT_VERSION_SHORT}.0"
!define CLASS "net.pms.PMS"
!define PRODUCT_NAME "PMS"

; Definitions for Java 7.0
!define JRE_VERSION "7.0"
; Definitions for Java
!define JRE6_VERSION "6.0"
!define JRE7_VERSION "7.0"
!define JRE_URL "http://download.oracle.com/otn-pub/java/jdk/7u3-b05/jre-7u3-windows-i586.exe"
!define JRE64_URL "http://download.oracle.com/otn-pub/java/jdk/7u3-b05/jre-7u3-windows-x64.exe"

Expand Down Expand Up @@ -137,7 +138,7 @@ Function GetJRE

DownloadJRE:
Call ElevateToAdmin
MessageBox MB_ICONINFORMATION "${PRODUCT_NAME} uses Java Runtime Environment ${JRE_VERSION}, it will now be downloaded and installed."
MessageBox MB_ICONINFORMATION "${PRODUCT_NAME} uses Java Runtime Environment ${JRE7_VERSION}, it will now be downloaded and installed."
StrCpy $2 "$TEMP\Java Runtime Environment.exe"
nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
Pop $R0 ;Get the return value
Expand Down Expand Up @@ -172,11 +173,17 @@ Function CheckJREVersion

; Get the file version of javaw.exe
${GetFileVersion} $R0 $R1
${VersionCompare} ${JRE_VERSION} $R1 $R1

; Check whether $R1 != "1"
ClearErrors

; Check if JRE6 is installed
${VersionCompare} ${JRE6_VERSION} $R1 $R1
StrCmp $R1 "1" 0 CheckDone

; Check if JRE7 is installed
${VersionCompare} ${JRE7_VERSION} $R1 $R1
StrCmp $R1 "1" 0 CheckDone

SetErrors

CheckDone:
Expand Down

0 comments on commit ff82c79

Please sign in to comment.