Skip to content

Instantly share code, notes, and snippets.

@oberhamsi
Last active December 19, 2015 23:59
Show Gist options
  • Save oberhamsi/6038570 to your computer and use it in GitHub Desktop.
Save oberhamsi/6038570 to your computer and use it in GitHub Desktop.
ringojs inno setup script
[Setup]
AppName=RingoJs
AppVersion=0.9.1
DefaultDirName={pf}\ringojs-0.9
DefaultGroupName=ORF ON
Compression=lzma2
SolidCompression=yes
[Files]
Source: "ringojs-0.9\*"; DestDir: "{app}"; Flags: createallsubdirs recursesubdirs
[Icons]
Name: "{group}\RingoJs Shell"; Filename: "{app}\bin\ringo.cmd"; WorkingDir: "{app}"
Name: "{group}\Update Package Manager"; Filename: "{app}\bin\ringo-admin.cmd"; Parameters: "install http://packages.ringojs.org/download/rp/latest"; WorkingDir: "{app}"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
[Registry]
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"
[Run]
Filename: "{app}\bin\ringo-admin.cmd"; Parameters: "install http://packages.ringojs.org/download/rp/latest"; Flags: shellexec waituntilterminated runhidden
[Code]
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssDone then
begin
// move file
RenameFile(ExpandConstant('{app}\packages\rp\bin\rp.cmd'), ExpandConstant('{app}\bin\rp.cmd'))
end;
end;
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaInstalled : Boolean;
Result1 : Boolean;
Versions: TArrayOfString;
I: Integer;
begin
if RegGetSubkeyNames(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', Versions) then
begin
for I := 0 to GetArrayLength(Versions)-1 do
if JavaInstalled = true then
begin
//do nothing
end else
begin
if ( Versions[I][2]='.' ) and ( ( StrToInt(Versions[I][1]) > 1 ) or ( ( StrToInt(Versions[I][1]) = 1 ) and ( StrToInt(Versions[I][3]) >= 6 ) ) ) then
begin
JavaInstalled := true;
end else
begin
JavaInstalled := false;
end;
end;
end else
begin
JavaInstalled := false;
end;
if JavaInstalled then
begin
Result := true;
end else
begin
Result1 := MsgBox('This tool requires Java Runtime Environment version 1.6 or newer to run. Please download and install the JRE and run this setup again. Do you want to download it now?',
mbConfirmation, MB_YESNO) = idYes;
if Result1 = false then
begin
Result:=false;
end else
begin
Result:=false;
ShellExec('open',
'http://www.java.com/getjava/',
'','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;
end;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment