Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- E:/Workspaces/sts/PA.c-Launcher/Other/Source/Segments/Java.nsh.orig Sun May 08 17:12:16 2011
- +++ E:/Workspaces/sts/PA.c-Launcher/Other/Source/Segments/Java.nsh Thu Jun 02 22:12:54 2011
- @@ -3,6 +3,8 @@
- Var UsingJavaExecutable
- Var JavaMode
- Var JavaDirectory
- +Var JDKMode
- +Var JDKDirectory
- ${SegmentInit}
- ; If [Activate]:Java=find|require, search for Java in the following
- @@ -51,6 +53,54 @@
- ${EndIf}
- ${EndIf}
- + ; Also, if [Activate]:JDK=find|require is set as well (Java must also be set),
- + ; search for the JDK in these locations (in order):
- + ;
- + ; - JDK_HOME user setting in the AppNamePortable.ini file
- + ; - [Java]:JDK_HOME
- + ; - PortableApps.com CommonFiles (..\CommonFiles\JDK)
- + ; - Registry (HKLM\Software\JavaSoft\Java Development Kit)
- + ; - %JDK_HOME%
- + ;
- + ; As above, [Activate]:JDK=require will abort if the JDK hasn't been found.
- + ; Note that, the [Java]:JDK_HOME option can be set a custom location on a
- + ; per application basis. The user can override this setting by setting
- + ; JDK_HOME in the AppNamePortable.ini file.
- + ; Then populate %JDK_HOME% with the JDK location.
- + ${ReadLauncherConfig} $JDKMode Activate JDK
- + ${If} $JDKMode == find
- + ${OrIf} $JDKMode == require
- + ; Set the Default JDKDirectory
- + StrCpy $JDKDirectory $PortableAppsDirectory\CommonFiles\JDK
- + ; Read the settings
- + ${ReadUserConfig} $0 JDK_HOME
- + ${ReadLauncherConfig} $1 Java JDK_HOME
- + ; Reset JDKDirectory according to those settings
- + ${IfNot} $0 == ''
- + StrCpy $JDKDirectory $0
- + ${ElseIfNot} $1 == ''
- + StrCpy $JDKDirectory $1
- + ${EndIf}
- +
- + ${IfNot} ${FileExists} $JDKDirectory
- + ClearErrors
- + ReadRegStr $0 HKLM "Software\JavaSoft\Java Development Kit" CurrentVersion
- + ReadRegStr $JDKDirectory HKLM "Software\JavaSoft\Java Development Kit\$0" JavaHome
- + ${If} ${Errors}
- + ${OrIfNot} ${FileExists} $JDKDirectory\bin\java.exe
- + ClearErrors
- + ReadEnvStr $JDKDirectory JDK_HOME
- + ${If} ${Errors}
- + ${OrIfNot} ${FileExists} $JDKDirectory\bin\java.exe
- + StrCpy $JavaDirectory $PortableAppsDirectory\CommonFiles\JDK
- + ${DebugMsg} "Unable to find JDK installation."
- + ${EndIf}
- + ${EndIf}
- + ${EndIf}
- + ${ElseIfNot} ${Errors}
- + ${InvalidValueError} [Activate]:JDK $JDKMode
- + ${EndIf}
- +
- ; If Java is required and not found, quit; if it is, check if
- ; [Launch]:ProgramExecutable is java.exe or javaw.exe.
- ${If} $JavaMode == require
- @@ -68,10 +118,21 @@
- Quit
- ${EndIf}
- ${EndIf}
- + ; If JDK is required and not found, quit. (Reuses the LauncherNoJava error message)
- + ${If} $JDKMode == require
- + ${IfNot} ${FileExists} $JDKDirectory
- + ;=== JDK Portable is missing
- + MessageBox MB_OK|MB_ICONSTOP `$(LauncherNoJava)`
- + Quit
- + ${EndIf}
- + ${EndIf}
- ; Now set %JAVA_HOME% to the path (still may not exist)
- ${DebugMsg} "Selected Java path: $JavaDirectory"
- ${SetEnvironmentVariablesPath} JAVA_HOME $JavaDirectory
- + ; Now set %JDK_HOME% to the path (still may not exist)
- + ${DebugMsg} "Selected JDK path: $JDKDirectory"
- + ${SetEnvironmentVariablesPath} JDK_HOME $JDKDirectory
- ${ElseIfNot} ${Errors}
- ${InvalidValueError} [Activate]:Java $JavaMode
- ${EndIf}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement