installer: Apache 2.0 license

installer: Apache 2.0 license

#define MyAppName "Zydeo Chinese dictionary"
#define MyAppNameShort "Zydeo"
#define MyAppVersion "1.0"
#define MyAppPublisher "Gbor L Ugray"
#define MyAppURL "http://zydeo.net/"
#define MyAppExeName "Zydeo.exe"

[Setup]
AppId={{46634FB3-D868-44F3-A55C-80852B9FC5AA}
MinVersion=0,5.01.2600
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppNameShort}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
Compression=lzma/normal
SolidCompression=yes
ShowLanguageDialog=no
DirExistsWarning=no
OutputDir=..\_install
OutputBaseFilename=ZydeoSetup-v{#MyAppVersion}
ArchitecturesInstallIn64BitMode=x64
FlatComponentsList=False
AlwaysShowComponentsList=False
ShowComponentSizes=False
DisableReadyPage=True
DisableReadyMemo=True
SetupIconFile=ZydeoSetup.ico
UninstallDisplayIcon={app}\ZydeoSetup.ico
WizardImageBackColor=clWhite
WizardImageFile=installer1.bmp
WizardSmallImageFile=installer2.bmp
VersionInfoCompany={#MyAppPublisher}
VersionInfoDescription={#MyAppName} setup
VersionInfoCopyright=(C) {#MyAppPublisher} 2015
VersionInfoVersion={#MyAppVersion}.0.0

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: isxdl.dll; Flags: dontcopy
Source: isxdl_english.ini; Flags: dontcopy

Source: "..\_bin\Zydeo.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.AU.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.CedictEngine.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Gui.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Gui.Zen.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.HanziLookup.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Texts.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\_bin\Fonts\Ubuntu-Bold.ttf"; DestDir: "{app}\Fonts"; Flags: ignoreversion
Source: "..\_bin\Fonts\Neuton-Regular.ttf"; DestDir: "{app}\Fonts"; Flags: ignoreversion
Source: "..\_bin\Data\cedict-zydeo.bin"; DestDir: "{app}\Data"; Flags: ignoreversion
Source: "..\_bin\Data\strokes-zydeo.bin"; DestDir: "{app}\Data"; Flags: ignoreversion

Source: "..\License.html"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-CC-BY-SA-3.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-GNU-GPL-3.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-ArphicPublicLicense.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-SIL-OpenFont-1.1.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-UbuntuFont-1.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-Apache-2.0.txt"; DestDir: "{app}"; Flags: ignoreversion

Source: "ZydeoSetup.ico"; DestDir: "{app}"; Flags: ignoreversion

[UninstallDelete]
;; Delete fonts that we have downloaded (not installed).
Type: filesandordirs; Name: "{app}\Fonts"

[Icons]
Name: "{commonstartmenu}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: {app}\ZD.AU.exe; Parameters: /install; WorkingDir: {app}; Flags: runascurrentuser
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: {app}\ZD.AU.exe; Parameters: /uninstall; WorkingDir: {app}; Flags: runascurrentuser

[Messages]
WinVersionTooLowError=Zydeo requires Windows XP Service Pack 3 or later.

[CustomMessages]
english.DotNetAdmin=Zydeo needs Microsoft .NET Framework v4.0 to be installed by an Administrator
english.Downloading=Downloading dependencies
english.DownloadDetail=Zydeo needs to download and install dependencies. Please wait while Setup is downloading extra files to your computer.

[Code]
var
  dotnetRedistPath: string;
  downloadNeeded: boolean;
  dotNetNeeded: boolean;
  arphicNeeded: boolean;
  notoNeeded: boolean;

procedure isxdl_AddFile(URL, Filename: AnsiString);
external 'isxdl_AddFile@files:isxdl.dll stdcall';
function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: AnsiString): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';

const
  dotnetRedistURL = 'http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe';
  notoUrl1 = 'http://zydeo.net/downloadinstaller?file=NotoSans-Regular.ttf';
  notoUrl2 = 'http://zydeo.net/downloadinstaller?file=NotoSans-Italic.ttf';
  notoUrl3 = 'http://zydeo.net/downloadinstaller?file=NotoSans-Bold.ttf';
  notoUrl4 = 'http://zydeo.net/downloadinstaller?file=NotoSans-BoldItalic.ttf';
  notoUrl5 = 'http://zydeo.net/downloadinstaller?file=NotoSansHans-Regular.otf';
  arphicUrl1 = 'http://zydeo.net/downloadinstaller?file=hdzb_75.ttf';
  arphicUrl2 = 'http://zydeo.net/downloadinstaller?file=ukaitw.ttf';

function InitializeSetup(): Boolean;
var
  Installed_40 : Cardinal;
  Installed_45: Cardinal;
  Version: String;
  QuerySuccess: Boolean;
  dfKaiExists: Boolean;
  kaiTiExists: Boolean;

begin
  Result := true;
  dotNetNeeded := false;
  arphicNeeded := false;
  notoNeeded := false;

  // Check for .NET 4.0 or 4.5 full profile
  RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', Installed_40);
  Installed_45 := 0;

  if (Installed_40 <> 0) then
  begin
    QuerySuccess := RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', Version);
    if not QuerySuccess then  // version unavailable
      Installed_40 := 0;
    if QuerySuccess and (Version[3] = '5') then begin // 4.5
      Installed_40 := 0;
      Installed_45 := 1;
    end;
  end;

  if (not ((Installed_45 <> 0) or (Installed_40 <> 0))) then begin
    dotNetNeeded := true;
    if (not IsAdminLoggedOn()) then begin
      MsgBox(CustomMessage('DotNetAdmin'), mbInformation, MB_OK);
      Result := false;
    end else begin
      dotnetRedistPath := ExpandConstant('{src}\dotNetFx40_Full_x86_x64.exe.exe');
      if not FileExists(dotnetRedistPath) then begin
        dotnetRedistPath := ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe.exe');
        if not FileExists(dotnetRedistPath) then begin
          isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
          downloadNeeded := true;
        end;
      end;
      SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
    end;
  end;

  // Check for existence of Segoe UI. If missing, Noto is needed.
  if (not FileExists(ExpandConstant('{fonts}\segoeui.ttf'))) then begin
    notoNeeded := true;
    downloadNeeded := true;
    isxdl_AddFile(notoUrl1, ExpandConstant('{tmp}\tmp-NotoSans-Regular.ttf'));
    isxdl_AddFile(notoUrl2, ExpandConstant('{tmp}\tmp-NotoSans-Italic.ttf'));
    isxdl_AddFile(notoUrl3, ExpandConstant('{tmp}\tmp-NotoSans-Bold.ttf'));
    isxdl_AddFile(notoUrl4, ExpandConstant('{tmp}\tmp-NotoSans-BoldItalic.ttf'));
    isxdl_AddFile(notoUrl5, ExpandConstant('{tmp}\tmp-NotoSansHans-Regular.otf'));
  end;

  // Check for existence of both DFKai-SB (kaiu.ttf) and KaiTi (simkai.ttf)
  // If either is missing, must get Arphic fonts
  dfKaiExists := FileExists(ExpandConstant('{fonts}\kaiu.ttf'));
  kaiTiExists := FileExists(ExpandConstant('{fonts}\simkai.ttf'));
  if (not dfKaiExists or not kaiTiExists) then begin
    arphicNeeded := true;
    downloadNeeded := true;
    isxdl_AddFile(arphicUrl1, ExpandConstant('{tmp}\tmp-hdzb_75.ttf'));
    isxdl_AddFile(arphicUrl2, ExpandConstant('{tmp}\tmp-ukaitw.ttf'));
  end;
end;

function NextButtonClick(CurPage: Integer): Boolean;
var
  hWnd: Integer;
  ResultCode: Integer;
  LangFileName: string;

begin
  Result := true;

  if CurPage = wpWelcome then begin
    hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
    // don't try to init isxdl if it's not needed because it will error on < ie 3
    if downloadNeeded then begin
  	  // Download dialog localized
  	  LangFileName := 'isxdl_' + ExpandConstant('{language}') + '.ini';
      ExtractTemporaryFile(LangFileName);
      isxdl_SetOption('language', ExpandConstant('{tmp}\') + LangFileName);
      isxdl_SetOption('label', CustomMessage('Downloading'));
      isxdl_SetOption('description', CustomMessage('DownloadDetail'));
      // Download files
      if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
    end;
    if (Result = true) and (dotNetNeeded = true) then begin
      if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
         // handle success if necessary; ResultCode contains the exit code
         if not (ResultCode = 0) then begin
           Result := false;
         end;
      end else begin
         // handle failure if necessary; ResultCode contains the error code
         Result := false;
      end;
    end;
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    // Copy downloaded files to app folder: Noto font(s)
    if notoNeeded then begin
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-Regular.ttf'), ExpandConstant('{app}\Fonts\NotoSans-Regular.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-Italic.ttf'), ExpandConstant('{app}\Fonts\NotoSans-Italic.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-Bold.ttf'), ExpandConstant('{app}\Fonts\NotoSans-Bold.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-BlodItalic.ttf'), ExpandConstant('{app}\Fonts\NotoSans-BlodItalic.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSansHans-Regular.otf'), ExpandConstant('{app}\Fonts\NotoSansHans-Regular.otf'), False);
    end;
    // Copy downloaded files to app folder: Arphic Kai font(s)
    if arphicNeeded then begin
      FileCopy(ExpandConstant('{tmp}\tmp-hdzb_75.ttf'), ExpandConstant('{app}\Fonts\hdzb_75.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-ukaitw.ttf'), ExpandConstant('{app}\Fonts\ukaitw.ttf'), False);
    end;
  end;
end;

#define MyAppName "Zydeo Chinese dictionary"
#define MyAppNameShort "Zydeo"
#define MyAppVersion "1.0"
#define MyAppPublisher "Gbor L Ugray"
#define MyAppURL "http://zydeo.net/"
#define MyAppExeName "Zydeo.exe"

[Setup]
AppId={{46634FB3-D868-44F3-A55C-80852B9FC5AA}
MinVersion=0,5.01.2600
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppNameShort}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
Compression=lzma/normal
SolidCompression=yes
ShowLanguageDialog=no
DirExistsWarning=no
OutputDir=..\_install
OutputBaseFilename=ZydeoSetup-v{#MyAppVersion}
ArchitecturesInstallIn64BitMode=x64
FlatComponentsList=False
AlwaysShowComponentsList=False
ShowComponentSizes=False
DisableReadyPage=True
DisableReadyMemo=True
SetupIconFile=ZydeoSetup.ico
UninstallDisplayIcon={app}\ZydeoSetup.ico
WizardImageBackColor=clWhite
WizardImageFile=installer1.bmp
WizardSmallImageFile=installer2.bmp
VersionInfoCompany={#MyAppPublisher}
VersionInfoDescription={#MyAppName} setup
VersionInfoCopyright=(C) {#MyAppPublisher} 2015
VersionInfoVersion={#MyAppVersion}.0.0

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: isxdl.dll; Flags: dontcopy
Source: isxdl_english.ini; Flags: dontcopy

Source: "..\_bin\Zydeo.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.AU.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.CedictEngine.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Gui.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Gui.Zen.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.HanziLookup.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\_bin\ZD.Texts.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\_bin\Fonts\Ubuntu-Bold.ttf"; DestDir: "{app}\Fonts"; Flags: ignoreversion
Source: "..\_bin\Fonts\Neuton-Regular.ttf"; DestDir: "{app}\Fonts"; Flags: ignoreversion
Source: "..\_bin\Data\cedict-zydeo.bin"; DestDir: "{app}\Data"; Flags: ignoreversion
Source: "..\_bin\Data\strokes-zydeo.bin"; DestDir: "{app}\Data"; Flags: ignoreversion

Source: "..\License.html"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-CC-BY-SA-3.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-GNU-GPL-3.0.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-ArphicPublicLicense.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-SIL-OpenFont-1.1.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\License-UbuntuFont-1.0.txt"; DestDir: "{app}"; Flags: ignoreversion

Source: "ZydeoSetup.ico"; DestDir: "{app}"; Flags: ignoreversion

[UninstallDelete]
;; Delete fonts that we have downloaded (not installed).
Type: filesandordirs; Name: "{app}\Fonts"

[Icons]
Name: "{commonstartmenu}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: {app}\ZD.AU.exe; Parameters: /install; WorkingDir: {app}; Flags: runascurrentuser
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: {app}\ZD.AU.exe; Parameters: /uninstall; WorkingDir: {app}; Flags: runascurrentuser

[Messages]
WinVersionTooLowError=Zydeo requires Windows XP Service Pack 3 or later.

[CustomMessages]
english.DotNetAdmin=Zydeo needs Microsoft .NET Framework v4.0 to be installed by an Administrator
english.Downloading=Downloading dependencies
english.DownloadDetail=Zydeo needs to download and install dependencies. Please wait while Setup is downloading extra files to your computer.

[Code]
var
  dotnetRedistPath: string;
  downloadNeeded: boolean;
  dotNetNeeded: boolean;
  arphicNeeded: boolean;
  notoNeeded: boolean;

procedure isxdl_AddFile(URL, Filename: AnsiString);
external 'isxdl_AddFile@files:isxdl.dll stdcall';
function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: AnsiString): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';

const
  dotnetRedistURL = 'http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe';
  notoUrl1 = 'http://zydeo.net/downloadinstaller?file=NotoSans-Regular.ttf';
  notoUrl2 = 'http://zydeo.net/downloadinstaller?file=NotoSans-Italic.ttf';
  notoUrl3 = 'http://zydeo.net/downloadinstaller?file=NotoSans-Bold.ttf';
  notoUrl4 = 'http://zydeo.net/downloadinstaller?file=NotoSans-BoldItalic.ttf';
  notoUrl5 = 'http://zydeo.net/downloadinstaller?file=NotoSansHans-Regular.otf';
  arphicUrl1 = 'http://zydeo.net/downloadinstaller?file=hdzb_75.ttf';
  arphicUrl2 = 'http://zydeo.net/downloadinstaller?file=ukaitw.ttf';

function InitializeSetup(): Boolean;
var
  Installed_40 : Cardinal;
  Installed_45: Cardinal;
  Version: String;
  QuerySuccess: Boolean;
  dfKaiExists: Boolean;
  kaiTiExists: Boolean;

begin
  Result := true;
  dotNetNeeded := false;
  arphicNeeded := false;
  notoNeeded := false;

  // Check for .NET 4.0 or 4.5 full profile
  RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', Installed_40);
  Installed_45 := 0;

  if (Installed_40 <> 0) then
  begin
    QuerySuccess := RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', Version);
    if not QuerySuccess then  // version unavailable
      Installed_40 := 0;
    if QuerySuccess and (Version[3] = '5') then begin // 4.5
      Installed_40 := 0;
      Installed_45 := 1;
    end;
  end;

  if (not ((Installed_45 <> 0) or (Installed_40 <> 0))) then begin
    dotNetNeeded := true;
    if (not IsAdminLoggedOn()) then begin
      MsgBox(CustomMessage('DotNetAdmin'), mbInformation, MB_OK);
      Result := false;
    end else begin
      dotnetRedistPath := ExpandConstant('{src}\dotNetFx40_Full_x86_x64.exe.exe');
      if not FileExists(dotnetRedistPath) then begin
        dotnetRedistPath := ExpandConstant('{tmp}\dotNetFx40_Full_x86_x64.exe.exe');
        if not FileExists(dotnetRedistPath) then begin
          isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
          downloadNeeded := true;
        end;
      end;
      SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
    end;
  end;

  // Check for existence of Segoe UI. If missing, Noto is needed.
  if (not FileExists(ExpandConstant('{fonts}\segoeui.ttf'))) then begin
    notoNeeded := true;
    downloadNeeded := true;
    isxdl_AddFile(notoUrl1, ExpandConstant('{tmp}\tmp-NotoSans-Regular.ttf'));
    isxdl_AddFile(notoUrl2, ExpandConstant('{tmp}\tmp-NotoSans-Italic.ttf'));
    isxdl_AddFile(notoUrl3, ExpandConstant('{tmp}\tmp-NotoSans-Bold.ttf'));
    isxdl_AddFile(notoUrl4, ExpandConstant('{tmp}\tmp-NotoSans-BoldItalic.ttf'));
    isxdl_AddFile(notoUrl5, ExpandConstant('{tmp}\tmp-NotoSansHans-Regular.otf'));
  end;

  // Check for existence of both DFKai-SB (kaiu.ttf) and KaiTi (simkai.ttf)
  // If either is missing, must get Arphic fonts
  dfKaiExists := FileExists(ExpandConstant('{fonts}\kaiu.ttf'));
  kaiTiExists := FileExists(ExpandConstant('{fonts}\simkai.ttf'));
  if (not dfKaiExists or not kaiTiExists) then begin
    arphicNeeded := true;
    downloadNeeded := true;
    isxdl_AddFile(arphicUrl1, ExpandConstant('{tmp}\tmp-hdzb_75.ttf'));
    isxdl_AddFile(arphicUrl2, ExpandConstant('{tmp}\tmp-ukaitw.ttf'));
  end;
end;

function NextButtonClick(CurPage: Integer): Boolean;
var
  hWnd: Integer;
  ResultCode: Integer;
  LangFileName: string;

begin
  Result := true;

  if CurPage = wpWelcome then begin
    hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
    // don't try to init isxdl if it's not needed because it will error on < ie 3
    if downloadNeeded then begin
  	  // Download dialog localized
  	  LangFileName := 'isxdl_' + ExpandConstant('{language}') + '.ini';
      ExtractTemporaryFile(LangFileName);
      isxdl_SetOption('language', ExpandConstant('{tmp}\') + LangFileName);
      isxdl_SetOption('label', CustomMessage('Downloading'));
      isxdl_SetOption('description', CustomMessage('DownloadDetail'));
      // Download files
      if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
    end;
    if (Result = true) and (dotNetNeeded = true) then begin
      if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
         // handle success if necessary; ResultCode contains the exit code
         if not (ResultCode = 0) then begin
           Result := false;
         end;
      end else begin
         // handle failure if necessary; ResultCode contains the error code
         Result := false;
      end;
    end;
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    // Copy downloaded files to app folder: Noto font(s)
    if notoNeeded then begin
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-Regular.ttf'), ExpandConstant('{app}\Fonts\NotoSans-Regular.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-Italic.ttf'), ExpandConstant('{app}\Fonts\NotoSans-Italic.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-Bold.ttf'), ExpandConstant('{app}\Fonts\NotoSans-Bold.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSans-BlodItalic.ttf'), ExpandConstant('{app}\Fonts\NotoSans-BlodItalic.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-NotoSansHans-Regular.otf'), ExpandConstant('{app}\Fonts\NotoSansHans-Regular.otf'), False);
    end;
    // Copy downloaded files to app folder: Arphic Kai font(s)
    if arphicNeeded then begin
      FileCopy(ExpandConstant('{tmp}\tmp-hdzb_75.ttf'), ExpandConstant('{app}\Fonts\hdzb_75.ttf'), False);
      FileCopy(ExpandConstant('{tmp}\tmp-ukaitw.ttf'), ExpandConstant('{app}\Fonts\ukaitw.ttf'), False);
    end;
  end;
end;


removed python35.dll copying (not needed, ships correctly with Python; resides in main folder), issue https://github.com/fifengine/fife-windows-sdk/issues/6

;
;          _\|/_
;          (o o)
; +-----oOO-{_}-OOo------------------------------------------------------+
; |                                                                      |
; |  Flexible Isometric Free Engine - Inno Setup Script File             |
; |  -------------------------------------------------------             |
; |                                                                      |
; |  Author:   Jens A. Koch <jakoch@web.de>                              |
; |  License:  MIT                                                       |
; |                                                                      |
; |  For the full copyright and license information, please view         |
; |  the LICENSE file that was distributed with this source code.        |
; |                                                                      |
; |  Note for developers                                                 |
; |  -------------------                                                 |
; |  A good resource for developing and understanding                    |
; |  Inno Setup Script files is the official "Inno Setup Help".          |
; |  Website:  http://jrsoftware.org/ishelp/index.php                    |
; |                                                                      |
; +---------------------------------------------------------------------<3

; version is set here, when the version isn't passed to the compiler on invocation
#ifndef APP_VERSION
#define APP_VERSION          "0.0.1"
#endif

#define APP_NAME             "FifeSDK"
#define APP_COMPILER         "VC14"
#define APP_PUBLISHER        "FIFE Team"
#define APP_URL              "http://fifengine.net/"
#define APP_SUPPORT_URL      "https://github.com/fifengine/fifengine/issues"
#define COPYRIGHT_YEAR        GetDateTimeString('yyyy', '', '');

[Setup]
AppId={{8A27DF0C-689B-4B76-8BFC-AFCDD90C1A31}

; set application meta-data
AppName={#APP_NAME}
AppVerName={#APP_NAME} {#APP_VERSION}
AppVersion={#APP_VERSION}
AppCopyright=© {#APP_PUBLISHER}
AppPublisher={#APP_PUBLISHER}
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_SUPPORT_URL}
AppUpdatesURL={#APP_URL}

; default installation folder is "c:\fife". users might change this via dialog.
DefaultDirName={pf}\FIFE\
DefaultGroupName={#APP_NAME}
DirExistsWarning=No
EnableDirDoesntExistWarning=Yes
AllowNoIcons=yes

; compression
Compression=lzma2/ultra
LZMAUseSeparateProcess=yes
LZMANumBlockThreads=2
InternalCompressLevel=max
SolidCompression=true

; style
WizardImageFile=images\WizardImage.bmp
WizardSmallImageFile=images\WizardSmallImage.bmp
SetupIconFile=images\fife.ico

; this creates the installer executable in the build folder
; for example: "_build\FifeSDK-0.4.0-Setup-VC14-x86.exe"
OutputBaseFilename={#APP_NAME}-{#APP_VERSION}-Setup-{#APP_COMPILER}-x86
OutputDir=..\_build

; disable wizard pages: Welcome (by default), Ready
DisableReadyPage=yes

; enable wizard pages: Select Destination Location
DisableDirPage=no

; Tell Windows Explorer to reload the environment, because Registry change (env PATH change)
ChangesEnvironment=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

; Define the types of installations
; The user gets a drop-down list to select one of these types.
; Selecting a type will selected a set of components.
[Types]
Name: "full";          Description: "Full installation (build-tools, engine, dependencies, demos, tools)"
Name: "build-tools";   Description: "Build-tools only (CMake, Python, Boost, Swig)"
Name: "fife-only";     Description: "Engine only"
;Name: "fife-demos";    Description: "Engine and Demos"
Name: "custom";        Description: "Custom installation"; Flags: iscustom

; Define components to install
[Components]
Name: fifengine;       Description: "[fifengine] Fifengine - Isometric Game Engine";    Types: full fife-only
;Name: fifengine;       Description: "[fifengine] Fifengine - Isometric Game Engine";    Types: full fife-only fife-demos
Name: dependencies;    Description: "[fifengine] Dependencies";                         Types: full;
;Name: demos;           Description: "[fifengine] Demos";                                Types: full fife-demos
Name: cmake;           Description: "[build tools] CMake - build system";               Types: full build-tools
Name: "Python";        Description: "[build tools] Python - programming language";
Name: "Python\py27";   Description: "[build tools] Python v2.7";                        Types: full build-tools; Flags: exclusive
Name: "Python\py35";   Description: "[build tools] Python v3.5";                        Types: full build-tools; Flags: exclusive
Name: swig;            Description: "[build tools] SWIG - interface generator";         Types: full build-tools;

[Files]
Source: "..\repackage\fifengine-includes\*";    DestDir: "{app}\fifengine-includes";    Flags: recursesubdirs ignoreversion; Components: dependencies
Source: "..\repackage\cmake\*";                 DestDir: "{app}\cmake";                 Flags: recursesubdirs ignoreversion; Components: cmake
Source: "..\repackage\swig\*";                  DestDir: "{app}\swig";                  Flags: recursesubdirs ignoreversion; Components: swig
; include Python from Appveyor
; https://www.appveyor.com/docs/installed-software/#python
Source: "C:\Python27\*";                        DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py27"
Source: "C:\Python35\*";                        DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py35"
; collect "PythonNN.dll", which resides in the windows system folder (SysWOW64 or system32)
Source: "C:\Windows\SysWOW64\python27.dll";     DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py27"
; Fifengine below Python, because we are installing the python library into the Python installation folder
Source: "..\repackage\libfife.win32-py2.7.msi"; DestDir: "{app}\libfife";               Flags: recursesubdirs;               Components: fifengine

; Define items to run automatically on installation...
[Run]
; install "libfife for python2.7" only when "python27" and "fifengine" are selected
; install silently into the target dir
Filename: "msiexec.exe"; Parameters: "/i ""{app}\libfife\libfife.win32-py2.7.msi"" TARGETDIR=""{app}\python"" /qn"; StatusMsg: "Installing libFife for Python2.7"; Components: Python\py27 and fifengine

; Define items to run automatically on un-installation...
[UninstallRun]
; un-install "libfife"
Filename: "msiexec.exe"; Parameters: "/x ""{app}\libfife\libfife.win32-py2.7.msi"" /qn"; StatusMsg: "Uninstalling libFife for Python2.7"; Flags: runascurrentuser runhidden

[Registry]
; A registry change needs the following directive: [SETUP] ChangesEnvironment=yes
; add path to python
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"PATH"; ValueData:"{olddata};{app}\python"; Flags: preservestringtype; Check: NeedsAddPath(ExpandConstant('{app}\python')); Components: Python\py27 or Python\py35;
; add path to libfife
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"PATH"; ValueData:"{olddata};{app}\python\Lib\site-packages\fife"; Flags: preservestringtype; Check: NeedsAddPath(ExpandConstant('{app}\python\Lib\site-packages\fife')); Components: fifengine;

[Code]
// modification and path lookup helper for env PATH
#include "includes\envpath.iss"

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
  appDir: string;
begin
  appDir := ExpandConstant('{app}');
  // finally, remove paths from the ENV path
  if (CurUninstallStep = usPostUninstall) then begin
     RemovePathFromEnvironmentPath(appDir + '\python');
     RemovePathFromEnvironmentPath(appDir + '\python\Lib\site-packages\fife');
     RemovePathFromEnvironmentPath(appDir);
  end;
end;

;
;          _\|/_
;          (o o)
; +-----oOO-{_}-OOo------------------------------------------------------+
; |                                                                      |
; |  Flexible Isometric Free Engine - Inno Setup Script File             |
; |  -------------------------------------------------------             |
; |                                                                      |
; |  Author:   Jens A. Koch <jakoch@web.de>                              |
; |  License:  MIT                                                       |
; |                                                                      |
; |  For the full copyright and license information, please view         |
; |  the LICENSE file that was distributed with this source code.        |
; |                                                                      |
; |  Note for developers                                                 |
; |  -------------------                                                 |
; |  A good resource for developing and understanding                    |
; |  Inno Setup Script files is the official "Inno Setup Help".          |
; |  Website:  http://jrsoftware.org/ishelp/index.php                    |
; |                                                                      |
; +---------------------------------------------------------------------<3

; version is set here, when the version isn't passed to the compiler on invocation
#ifndef APP_VERSION
#define APP_VERSION          "0.0.1"
#endif

#define APP_NAME             "FifeSDK"
#define APP_COMPILER         "VC14"
#define APP_PUBLISHER        "FIFE Team"
#define APP_URL              "http://fifengine.net/"
#define APP_SUPPORT_URL      "https://github.com/fifengine/fifengine/issues"
#define COPYRIGHT_YEAR        GetDateTimeString('yyyy', '', '');

[Setup]
AppId={{8A27DF0C-689B-4B76-8BFC-AFCDD90C1A31}

; set application meta-data
AppName={#APP_NAME}
AppVerName={#APP_NAME} {#APP_VERSION}
AppVersion={#APP_VERSION}
AppCopyright=© {#APP_PUBLISHER}
AppPublisher={#APP_PUBLISHER}
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_SUPPORT_URL}
AppUpdatesURL={#APP_URL}

; default installation folder is "c:\fife". users might change this via dialog.
DefaultDirName={pf}\FIFE\
DefaultGroupName={#APP_NAME}
DirExistsWarning=No
EnableDirDoesntExistWarning=Yes
AllowNoIcons=yes

; compression
Compression=lzma2/ultra
LZMAUseSeparateProcess=yes
LZMANumBlockThreads=2
InternalCompressLevel=max
SolidCompression=true

; style
WizardImageFile=images\WizardImage.bmp
WizardSmallImageFile=images\WizardSmallImage.bmp
SetupIconFile=images\fife.ico

; this creates the installer executable in the build folder
; for example: "_build\FifeSDK-0.4.0-Setup-VC14-x86.exe"
OutputBaseFilename={#APP_NAME}-{#APP_VERSION}-Setup-{#APP_COMPILER}-x86
OutputDir=..\_build

; disable wizard pages: Welcome (by default), Ready
DisableReadyPage=yes

; enable wizard pages: Select Destination Location
DisableDirPage=no

; Tell Windows Explorer to reload the environment, because Registry change (env PATH change)
ChangesEnvironment=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

; Define the types of installations
; The user gets a drop-down list to select one of these types.
; Selecting a type will selected a set of components.
[Types]
Name: "full";          Description: "Full installation (build-tools, engine, dependencies, demos, tools)"
Name: "build-tools";   Description: "Build-tools only (CMake, Python, Boost, Swig)"
Name: "fife-only";     Description: "Engine only"
;Name: "fife-demos";    Description: "Engine and Demos"
Name: "custom";        Description: "Custom installation"; Flags: iscustom

; Define components to install
[Components]
Name: fifengine;       Description: "[fifengine] Fifengine - Isometric Game Engine";    Types: full fife-only
;Name: fifengine;       Description: "[fifengine] Fifengine - Isometric Game Engine";    Types: full fife-only fife-demos
Name: dependencies;    Description: "[fifengine] Dependencies";                         Types: full;
;Name: demos;           Description: "[fifengine] Demos";                                Types: full fife-demos
Name: cmake;           Description: "[build tools] CMake - build system";               Types: full build-tools
Name: "Python";        Description: "[build tools] Python - programming language";
Name: "Python\py27";   Description: "[build tools] Python v2.7";                        Types: full build-tools; Flags: exclusive
Name: "Python\py35";   Description: "[build tools] Python v3.5";                        Types: full build-tools; Flags: exclusive
Name: swig;            Description: "[build tools] SWIG - interface generator";         Types: full build-tools;

[Files]
Source: "..\repackage\fifengine-includes\*";    DestDir: "{app}\fifengine-includes";    Flags: recursesubdirs ignoreversion; Components: dependencies
Source: "..\repackage\cmake\*";                 DestDir: "{app}\cmake";                 Flags: recursesubdirs ignoreversion; Components: cmake
Source: "..\repackage\swig\*";                  DestDir: "{app}\swig";                  Flags: recursesubdirs ignoreversion; Components: swig
; include Python from Appveyor
; https://www.appveyor.com/docs/installed-software/#python
Source: "C:\Python27\*";                        DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py27"
Source: "C:\Python35\*";                        DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py35"
; collect "PythonNN.dll", which resides in the windows system folder (SysWOW64 or system32)
Source: "C:\Windows\SysWOW64\python27.dll";     DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py27"
; Python35.dll doesn't exist on appveyor?
;Source: "C:\Windows\SysWOW64\python35.dll";     DestDir: "{app}\python";                Flags: recursesubdirs ignoreversion; Components: "Python\py35"
; Fifengine below Python, because we are installing the python library into the Python installation folder
Source: "..\repackage\libfife.win32-py2.7.msi"; DestDir: "{app}\libfife";               Flags: recursesubdirs;               Components: fifengine

; Define items to run automatically on installation...
[Run]
; install "libfife for python2.7" only when "python27" and "fifengine" are selected
; install silently into the target dir
Filename: "msiexec.exe"; Parameters: "/i ""{app}\libfife\libfife.win32-py2.7.msi"" TARGETDIR=""{app}\python"" /qn"; StatusMsg: "Installing libFife for Python2.7"; Components: Python\py27 and fifengine

; Define items to run automatically on un-installation...
[UninstallRun]
; un-install "libfife"
Filename: "msiexec.exe"; Parameters: "/x ""{app}\libfife\libfife.win32-py2.7.msi"" /qn"; StatusMsg: "Uninstalling libFife for Python2.7"; Flags: runascurrentuser runhidden

[Registry]
; A registry change needs the following directive: [SETUP] ChangesEnvironment=yes
; add path to python
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"PATH"; ValueData:"{olddata};{app}\python"; Flags: preservestringtype; Check: NeedsAddPath(ExpandConstant('{app}\python')); Components: Python\py27 or Python\py35;
; add path to libfife
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"PATH"; ValueData:"{olddata};{app}\python\Lib\site-packages\fife"; Flags: preservestringtype; Check: NeedsAddPath(ExpandConstant('{app}\python\Lib\site-packages\fife')); Components: fifengine;

[Code]
// modification and path lookup helper for env PATH
#include "includes\envpath.iss"

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
  appDir: string;
begin
  appDir := ExpandConstant('{app}');
  // finally, remove paths from the ENV path
  if (CurUninstallStep = usPostUninstall) then begin
     RemovePathFromEnvironmentPath(appDir + '\python');
     RemovePathFromEnvironmentPath(appDir + '\python\Lib\site-packages\fife');
     RemovePathFromEnvironmentPath(appDir);
  end;
end;


Nr wesji

Nr wesji

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "pesel2pbn"
#define MyAppVersion "0.2.2"
#define MyAppPublisher "IPLWeb - Michał Pasternak"
#define MyAppURL "https://github.com/mpasternak/pesel2pbn/"
#define MyAppExeName "pesel2pbn.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FBF132EC-8EA4-4557-9381-D28602DBDAFB}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}-{#MyAppVersion}
DefaultGroupName="{#MyAppName} {#MyAppVersion}"
AllowNoIcons=yes
LicenseFile=LICENSE
OutputBaseFilename=pesel2pbn-setup-{#MyAppVersion}
Compression=lzma
SolidCompression=yes

[Languages]
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "src\build\exe.win32-3.6\pesel2pbn.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\build\exe.win32-3.6\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "pesel2pbn"
#define MyAppVersion "0.2.1"
#define MyAppPublisher "IPLWeb - Michał Pasternak"
#define MyAppURL "https://github.com/mpasternak/pesel2pbn/"
#define MyAppExeName "pesel2pbn.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{FBF132EC-8EA4-4557-9381-D28602DBDAFB}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}-{#MyAppVersion}
DefaultGroupName="{#MyAppName} {#MyAppVersion}"
AllowNoIcons=yes
LicenseFile=LICENSE
OutputBaseFilename=pesel2pbn-setup-{#MyAppVersion}
Compression=lzma
SolidCompression=yes

[Languages]
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "src\build\exe.win32-3.6\pesel2pbn.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\build\exe.win32-3.6\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent


Reset the official plugins folder in the update installer

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "TweetDuck"
#define MyAppPublisher "chylex"
#define MyAppURL "https://tweetduck.chylex.com"
#define MyAppExeName "TweetDuck.exe"

#define MyAppID "8C25A716-7E11-4AAD-9992-8B5D0C78AE06"
#define MyAppVersion GetFileVersion("..\bin\x86\Release\TweetDuck.exe")
#define CefVersion GetFileVersion("..\bin\x86\Release\libcef.dll")

[Setup]
AppId={{{#MyAppID}}
AppName={#MyAppName} Update
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename={#MyAppName}.Update
VersionInfoVersion={#MyAppVersion}
SetupIconFile=.\Resources\icon.ico
Uninstallable=TDIsUninstallable
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
PrivilegesRequired=lowest
Compression=lzma/normal
SolidCompression=True
InternalCompressLevel=normal
MinVersion=0,6.1

#include <idp.iss>

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "..\bin\x86\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\TweetDuck.*"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\TweetLib.*"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\scripts\*.*"; DestDir: "{app}\scripts"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\bin\x86\Release\plugins\*.*"; DestDir: "{app}\plugins"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: TDIsUninstallable

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Parameters: "{code:TDGetRunArgs}"; Flags: nowait postinstall shellexec

[UninstallDelete]
Type: files; Name: "{app}\*.*"
Type: filesandordirs; Name: "{app}\locales"
Type: filesandordirs; Name: "{app}\scripts"
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Cache"
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"

[InstallDelete]
Type: filesandordirs; Name: "{app}\plugins\official"

[Code]
function TDIsUninstallable: Boolean; forward;
function TDGetRunArgs(Param: String): String; forward;
function TDFindUpdatePath: String; forward;
function TDGetNetFrameworkVersion: Cardinal; forward;
function TDGetAppVersionClean: String; forward;
function TDGetFullDownloadFileName: String; forward;
function TDIsMatchingCEFVersion: Boolean; forward;
procedure TDExecuteFullDownload; forward;

var IsPortable: Boolean;
var UpdatePath: String;

{ Check .NET Framework version on startup, ask user if they want to proceed if older than 4.5.2. Prepare full download package if required. }
function InitializeSetup: Boolean;
begin
  IsPortable := ExpandConstant('{param:PORTABLE}') = '1'
  UpdatePath := TDFindUpdatePath()

  if UpdatePath = '' then
  begin
    MsgBox('{#MyAppName} installation could not be found on your system.', mbCriticalError, MB_OK);
    Result := False;
    Exit;
  end;

  if not TDIsMatchingCEFVersion() then
  begin
    idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/releases/download/'+TDGetAppVersionClean()+'/'+TDGetFullDownloadFileName(), ExpandConstant('{tmp}\{#MyAppName}.Full.exe'));
  end;

  if TDGetNetFrameworkVersion() >= 379893 then
  begin
    Result := True;
    Exit;
  end;

  if (MsgBox('{#MyAppName} requires .NET Framework 4.5.2 or newer,'+#13+#10+'please download it from {#MyAppURL}'+#13+#10+#13+#10'Do you want to proceed with the setup anyway?', mbCriticalError, MB_YESNO or MB_DEFBUTTON2) = IDNO) then
  begin
    Result := False;
    Exit;
  end;

  Result := True;
end;

{ Prepare download plugin if there are any files to download, and set the installation path. }
procedure InitializeWizard();
begin
  WizardForm.DirEdit.Text := UpdatePath;

  if idpFilesCount <> 0 then
  begin
    idpDownloadAfter(wpReady);
  end;
end;

{ Ask user if they want to delete 'AppData\TweetDuck' and 'plugins' folders after uninstallation. }
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var ProfileDataFolder: String;
var PluginDataFolder: String;

begin
  if CurUninstallStep = usPostUninstall then
  begin
    ProfileDataFolder := ExpandConstant('{localappdata}\{#MyAppName}');
    PluginDataFolder := ExpandConstant('{app}\plugins');

    if (DirExists(ProfileDataFolder) or DirExists(PluginDataFolder)) and (MsgBox('Do you also want to delete your {#MyAppName} profile and plugins?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES) then
    begin
      DelTree(ProfileDataFolder, True, True, True);
      DelTree(PluginDataFolder, True, True, True);
      DelTree(ExpandConstant('{app}'), True, False, False);
    end;
  end;
end;

{ Remove uninstallation data and application to force them to be replaced with updated ones. }
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    TDExecuteFullDownload();

    if TDIsUninstallable() then
    begin
      DeleteFile(ExpandConstant('{app}\unins000.dat'));
      DeleteFile(ExpandConstant('{app}\unins000.exe'));
    end;
  end;
end;

{ Returns true if the installer should create uninstallation entries (i.e. not running in portable mode). }
function TDIsUninstallable: Boolean;
begin
  Result := not IsPortable
end;

{ Returns a string used for arguments when running the app after update. }
function TDGetRunArgs(Param: String): String;
var Args: String;
begin
  Args := ExpandConstant('{param:RUNARGS}')
  StringChangeEx(Args, '::', '"', True)
  Result := Args
end;

{ Returns a validated installation path (including trailing backslash) using the /UPDATEPATH parameter or installation info in registry. Returns empty string on failure. }
function TDFindUpdatePath: String;
var Path: String;
var RegistryKey: String;

begin
  Path := ExpandConstant('{param:UPDATEPATH}')

  if (Path = '') and not IsPortable then
  begin
    RegistryKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppID}}_is1'

    if not (RegQueryStringValue(HKEY_CURRENT_USER, RegistryKey, 'InstallLocation', Path) or RegQueryStringValue(HKEY_LOCAL_MACHINE, RegistryKey, 'InstallLocation', Path)) then
    begin
      Result := ''
      Exit
    end;
  end;

  if not FileExists(Path+'{#MyAppExeName}') then
  begin
    Result := ''
    Exit
  end;

  Result := Path
end;

{ Return DWORD value containing the build version of .NET Framework. }
function TDGetNetFrameworkVersion: Cardinal;
var FrameworkVersion: Cardinal;

begin
  if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then
  begin
    Result := FrameworkVersion;
    Exit;
  end;

  Result := 0;
end;

{ Return the name of the full installer file to download from GitHub. }
function TDGetFullDownloadFileName: String;
begin
  if IsPortable then Result := '{#MyAppName}.Portable.exe' else Result := '{#MyAppName}.exe';
end;

{ Return whether the version of the installed libcef.dll library matches internal one. }
function TDIsMatchingCEFVersion: Boolean;
var CEFVersion: String;

begin
  Result := (GetVersionNumbersString(UpdatePath+'libcef.dll', CEFVersion) and (CompareStr(CEFVersion, '{#CefVersion}') = 0))
end;

{ Return a cleaned up form of the app version string (removes all .0 suffixes). }
function TDGetAppVersionClean: String;
var Substr: String;
var CleanVersion: String;

begin
  CleanVersion := '{#MyAppVersion}'

  while True do
  begin
    Substr := Copy(CleanVersion, Length(CleanVersion)-1, 2);

    if (CompareStr(Substr, '.0') <> 0) then
    begin
      break;
    end;

    CleanVersion := Copy(CleanVersion, 1, Length(CleanVersion)-2);
  end;

  Result := CleanVersion;
end;

{ Run the full package installer if downloaded. }
procedure TDExecuteFullDownload;
var InstallFile: String;
var ResultCode: Integer;

begin
  InstallFile := ExpandConstant('{tmp}\{#MyAppName}.Full.exe')

  if FileExists(InstallFile) then
  begin
    WizardForm.ProgressGauge.Style := npbstMarquee;

    try
      if Exec(InstallFile, '/SP- /SILENT /MERGETASKS="!desktopicon" /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
      begin
        if ResultCode <> 0 then
        begin
          DeleteFile(InstallFile);
          Abort();
          Exit;
        end;
      end else
      begin
        MsgBox('Could not run the full installer, please visit {#MyAppURL} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK);

        DeleteFile(InstallFile);
        Abort();
        Exit;
      end;
    finally
      WizardForm.ProgressGauge.Style := npbstNormal;
      DeleteFile(InstallFile);
    end;
  end;
end;

; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "TweetDuck"
#define MyAppPublisher "chylex"
#define MyAppURL "https://tweetduck.chylex.com"
#define MyAppExeName "TweetDuck.exe"

#define MyAppID "8C25A716-7E11-4AAD-9992-8B5D0C78AE06"
#define MyAppVersion GetFileVersion("..\bin\x86\Release\TweetDuck.exe")
#define CefVersion GetFileVersion("..\bin\x86\Release\libcef.dll")

[Setup]
AppId={{{#MyAppID}}
AppName={#MyAppName} Update
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename={#MyAppName}.Update
VersionInfoVersion={#MyAppVersion}
SetupIconFile=.\Resources\icon.ico
Uninstallable=TDIsUninstallable
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
PrivilegesRequired=lowest
Compression=lzma/normal
SolidCompression=True
InternalCompressLevel=normal
MinVersion=0,6.1

#include <idp.iss>

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "..\bin\x86\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\TweetDuck.*"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\TweetLib.*"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\scripts\*.*"; DestDir: "{app}\scripts"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\bin\x86\Release\plugins\*.*"; DestDir: "{app}\plugins"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: TDIsUninstallable

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Parameters: "{code:TDGetRunArgs}"; Flags: nowait postinstall shellexec

[UninstallDelete]
Type: files; Name: "{app}\*.*"
Type: filesandordirs; Name: "{app}\locales"
Type: filesandordirs; Name: "{app}\scripts"
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\Cache"
Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"

[InstallDelete]
Type: files; Name: "{app}\plugins\official\emoji-keyboard\emoji-instructions.txt"

[Code]
function TDIsUninstallable: Boolean; forward;
function TDGetRunArgs(Param: String): String; forward;
function TDFindUpdatePath: String; forward;
function TDGetNetFrameworkVersion: Cardinal; forward;
function TDGetAppVersionClean: String; forward;
function TDGetFullDownloadFileName: String; forward;
function TDIsMatchingCEFVersion: Boolean; forward;
procedure TDExecuteFullDownload; forward;

var IsPortable: Boolean;
var UpdatePath: String;

{ Check .NET Framework version on startup, ask user if they want to proceed if older than 4.5.2. Prepare full download package if required. }
function InitializeSetup: Boolean;
begin
  IsPortable := ExpandConstant('{param:PORTABLE}') = '1'
  UpdatePath := TDFindUpdatePath()

  if UpdatePath = '' then
  begin
    MsgBox('{#MyAppName} installation could not be found on your system.', mbCriticalError, MB_OK);
    Result := False;
    Exit;
  end;

  if not TDIsMatchingCEFVersion() then
  begin
    idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/releases/download/'+TDGetAppVersionClean()+'/'+TDGetFullDownloadFileName(), ExpandConstant('{tmp}\{#MyAppName}.Full.exe'));
  end;

  if TDGetNetFrameworkVersion() >= 379893 then
  begin
    Result := True;
    Exit;
  end;

  if (MsgBox('{#MyAppName} requires .NET Framework 4.5.2 or newer,'+#13+#10+'please download it from {#MyAppURL}'+#13+#10+#13+#10'Do you want to proceed with the setup anyway?', mbCriticalError, MB_YESNO or MB_DEFBUTTON2) = IDNO) then
  begin
    Result := False;
    Exit;
  end;

  Result := True;
end;

{ Prepare download plugin if there are any files to download, and set the installation path. }
procedure InitializeWizard();
begin
  WizardForm.DirEdit.Text := UpdatePath;

  if idpFilesCount <> 0 then
  begin
    idpDownloadAfter(wpReady);
  end;
end;

{ Ask user if they want to delete 'AppData\TweetDuck' and 'plugins' folders after uninstallation. }
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var ProfileDataFolder: String;
var PluginDataFolder: String;

begin
  if CurUninstallStep = usPostUninstall then
  begin
    ProfileDataFolder := ExpandConstant('{localappdata}\{#MyAppName}');
    PluginDataFolder := ExpandConstant('{app}\plugins');

    if (DirExists(ProfileDataFolder) or DirExists(PluginDataFolder)) and (MsgBox('Do you also want to delete your {#MyAppName} profile and plugins?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES) then
    begin
      DelTree(ProfileDataFolder, True, True, True);
      DelTree(PluginDataFolder, True, True, True);
      DelTree(ExpandConstant('{app}'), True, False, False);
    end;
  end;
end;

{ Remove uninstallation data and application to force them to be replaced with updated ones. }
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    TDExecuteFullDownload();

    if TDIsUninstallable() then
    begin
      DeleteFile(ExpandConstant('{app}\unins000.dat'));
      DeleteFile(ExpandConstant('{app}\unins000.exe'));
    end;
  end;
end;

{ Returns true if the installer should create uninstallation entries (i.e. not running in portable mode). }
function TDIsUninstallable: Boolean;
begin
  Result := not IsPortable
end;

{ Returns a string used for arguments when running the app after update. }
function TDGetRunArgs(Param: String): String;
var Args: String;
begin
  Args := ExpandConstant('{param:RUNARGS}')
  StringChangeEx(Args, '::', '"', True)
  Result := Args
end;

{ Returns a validated installation path (including trailing backslash) using the /UPDATEPATH parameter or installation info in registry. Returns empty string on failure. }
function TDFindUpdatePath: String;
var Path: String;
var RegistryKey: String;

begin
  Path := ExpandConstant('{param:UPDATEPATH}')

  if (Path = '') and not IsPortable then
  begin
    RegistryKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppID}}_is1'

    if not (RegQueryStringValue(HKEY_CURRENT_USER, RegistryKey, 'InstallLocation', Path) or RegQueryStringValue(HKEY_LOCAL_MACHINE, RegistryKey, 'InstallLocation', Path)) then
    begin
      Result := ''
      Exit
    end;
  end;

  if not FileExists(Path+'{#MyAppExeName}') then
  begin
    Result := ''
    Exit
  end;

  Result := Path
end;

{ Return DWORD value containing the build version of .NET Framework. }
function TDGetNetFrameworkVersion: Cardinal;
var FrameworkVersion: Cardinal;

begin
  if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then
  begin
    Result := FrameworkVersion;
    Exit;
  end;

  Result := 0;
end;

{ Return the name of the full installer file to download from GitHub. }
function TDGetFullDownloadFileName: String;
begin
  if IsPortable then Result := '{#MyAppName}.Portable.exe' else Result := '{#MyAppName}.exe';
end;

{ Return whether the version of the installed libcef.dll library matches internal one. }
function TDIsMatchingCEFVersion: Boolean;
var CEFVersion: String;

begin
  Result := (GetVersionNumbersString(UpdatePath+'libcef.dll', CEFVersion) and (CompareStr(CEFVersion, '{#CefVersion}') = 0))
end;

{ Return a cleaned up form of the app version string (removes all .0 suffixes). }
function TDGetAppVersionClean: String;
var Substr: String;
var CleanVersion: String;

begin
  CleanVersion := '{#MyAppVersion}'

  while True do
  begin
    Substr := Copy(CleanVersion, Length(CleanVersion)-1, 2);

    if (CompareStr(Substr, '.0') <> 0) then
    begin
      break;
    end;

    CleanVersion := Copy(CleanVersion, 1, Length(CleanVersion)-2);
  end;

  Result := CleanVersion;
end;

{ Run the full package installer if downloaded. }
procedure TDExecuteFullDownload;
var InstallFile: String;
var ResultCode: Integer;

begin
  InstallFile := ExpandConstant('{tmp}\{#MyAppName}.Full.exe')

  if FileExists(InstallFile) then
  begin
    WizardForm.ProgressGauge.Style := npbstMarquee;

    try
      if Exec(InstallFile, '/SP- /SILENT /MERGETASKS="!desktopicon" /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
      begin
        if ResultCode <> 0 then
        begin
          DeleteFile(InstallFile);
          Abort();
          Exit;
        end;
      end else
      begin
        MsgBox('Could not run the full installer, please visit {#MyAppURL} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK);

        DeleteFile(InstallFile);
        Abort();
        Exit;
      end;
    finally
      WizardForm.ProgressGauge.Style := npbstNormal;
      DeleteFile(InstallFile);
    end;
  end;
end;


Remove administrative privileges requirement.

This resolves Bug #26474.

; Ruby Installer - InnoSetup Script (base)
; This script is used to build Ruby Installers for Windows

; PRE-CHECK
; Verify if both RubyPath and RubyVersion are defined
; by ISCC using /d parameter:
;  iscc rubyinstaller.iss /dRubyVersion=X.Y.Z /dRubyPatch=123 /dRubyPath=sandbox/ruby18_mingw

#if Defined(RubyVersion) == 0
  #error Please provide a RubyVersion definition using /d parameter.
#endif

#if Defined(RubyPatch) == 0
  #error Please provide a RubyPatch levle definition using /d parameter.
#endif

#if Defined(RubyPath) == 0
  #error Please provide the location of the Ruby to be used with RubyPath variable.
#else
  #if FileExists(RubyPath + '\bin\ruby.exe') == 0
    #error No Ruby installation (bin\ruby.exe) found inside defined RubyPath. Please verify.
  #endif
#endif

; Grab MAJOR.MINOR info from RubyVersion (1.8)
#define RubyMajorMinor Copy(RubyVersion, 1, 3)
#define RubyFullVersion RubyVersion + '-p' + RubyPatch

; Build Installer details using above values
#define InstallerName "Ruby " + RubyFullVersion
#define InstallerPublisher "RubyInstaller Project"
#define InstallerHomepage "http://rubyinstaller.org"

; INCLUDE
; Include version specific definitions
#define InstallerSpecificFile "config-" + RubyMajorMinor + ".iss"
#include InstallerSpecificFile

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications!
AppName={#InstallerName}
AppVerName={#InstallerName}
AppPublisher={#InstallerPublisher}
AppPublisherURL={#InstallerHomepage}
AppVersion={#RubyFullVersion}
DefaultGroupName={#InstallerName}
DisableProgramGroupPage=true
LicenseFile=LICENSE.rtf
Compression=lzma/ultra64
SolidCompression=true
AlwaysShowComponentsList=false
DisableReadyPage=true
InternalCompressLevel=ultra64
VersionInfoCompany={#InstallerPublisher}
VersionInfoCopyright=(c) 2009 {#InstallerPublisher}
VersionInfoDescription=Ruby Programming Language for Windows
VersionInfoTextVersion={#RubyFullVersion}
VersionInfoVersion={#RubyVersion}.{#RubyPatch}
UninstallDisplayIcon={app}\bin\ruby.exe
WizardImageFile=compiler:wizmodernimage-is.bmp
WizardSmallImageFile={#SourcePath}\wizard-logo.bmp
PrivilegesRequired=none

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: ..\..\{#RubyPath}\*; DestDir: {app}; Flags: recursesubdirs createallsubdirs
Source: setrbvars.bat; DestDir: {app}\bin

[Icons]
Name: {group}\Documentation\Getting Started; Filename: http://www.ruby-doc.org/gettingstarted/
Name: {group}\Documentation\Standard Library; Filename: http://www.ruby-doc.org/stdlib/
Name: {group}\Documentation\User's Guide; Filename: http://www.ruby-doc.org/docs/UsersGuide/rg/
Name: {group}\Interactive Ruby; Filename: {app}\bin\irb.bat; IconFilename: {app}\bin\ruby.exe; Flags: createonlyiffileexists
Name: {group}\RubyGems Documentation Server; Filename: {app}\bin\gem.bat; Parameters: server; IconFilename: {app}\bin\ruby.exe; Flags: createonlyiffileexists runminimized
Name: {group}\Start Command Prompt with Ruby; Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\bin\setrbvars.bat; WorkingDir: {%HOMEDRIVE}{%HOMEPATH}; IconFilename: {sys}\cmd.exe; Flags: createonlyiffileexists
Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe}

; Ruby Installer - InnoSetup Script (base)
; This script is used to build Ruby Installers for Windows

; PRE-CHECK
; Verify if both RubyPath and RubyVersion are defined
; by ISCC using /d parameter:
;  iscc rubyinstaller.iss /dRubyVersion=X.Y.Z /dRubyPatch=123 /dRubyPath=sandbox/ruby18_mingw

#if Defined(RubyVersion) == 0
  #error Please provide a RubyVersion definition using /d parameter.
#endif

#if Defined(RubyPatch) == 0
  #error Please provide a RubyPatch levle definition using /d parameter.
#endif

#if Defined(RubyPath) == 0
  #error Please provide the location of the Ruby to be used with RubyPath variable.
#else
  #if FileExists(RubyPath + '\bin\ruby.exe') == 0
    #error No Ruby installation (bin\ruby.exe) found inside defined RubyPath. Please verify.
  #endif
#endif

; Grab MAJOR.MINOR info from RubyVersion (1.8)
#define RubyMajorMinor Copy(RubyVersion, 1, 3)
#define RubyFullVersion RubyVersion + '-p' + RubyPatch

; Build Installer details using above values
#define InstallerName "Ruby " + RubyFullVersion
#define InstallerPublisher "RubyInstaller Project"
#define InstallerHomepage "http://rubyinstaller.org"

; INCLUDE
; Include version specific definitions
#define InstallerSpecificFile "config-" + RubyMajorMinor + ".iss"
#include InstallerSpecificFile

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications!
AppName={#InstallerName}
AppVerName={#InstallerName}
AppPublisher={#InstallerPublisher}
AppPublisherURL={#InstallerHomepage}
AppVersion={#RubyFullVersion}
DefaultGroupName={#InstallerName}
DisableProgramGroupPage=true
LicenseFile=LICENSE.rtf
Compression=lzma/ultra64
SolidCompression=true
AlwaysShowComponentsList=false
DisableReadyPage=true
InternalCompressLevel=ultra64
VersionInfoCompany={#InstallerPublisher}
VersionInfoCopyright=(c) 2009 {#InstallerPublisher}
VersionInfoDescription=Ruby Programming Language for Windows
VersionInfoTextVersion={#RubyFullVersion}
VersionInfoVersion={#RubyVersion}.{#RubyPatch}
UninstallDisplayIcon={app}\bin\ruby.exe
WizardImageFile=compiler:wizmodernimage-is.bmp
WizardSmallImageFile={#SourcePath}\wizard-logo.bmp

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: ..\..\{#RubyPath}\*; DestDir: {app}; Flags: recursesubdirs createallsubdirs
Source: setrbvars.bat; DestDir: {app}\bin

[Icons]
Name: {group}\Documentation\Getting Started; Filename: http://www.ruby-doc.org/gettingstarted/
Name: {group}\Documentation\Standard Library; Filename: http://www.ruby-doc.org/stdlib/
Name: {group}\Documentation\User's Guide; Filename: http://www.ruby-doc.org/docs/UsersGuide/rg/
Name: {group}\Interactive Ruby; Filename: {app}\bin\irb.bat; IconFilename: {app}\bin\ruby.exe; Flags: createonlyiffileexists
Name: {group}\RubyGems Documentation Server; Filename: {app}\bin\gem.bat; Parameters: server; IconFilename: {app}\bin\ruby.exe; Flags: createonlyiffileexists runminimized
Name: {group}\Start Command Prompt with Ruby; Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\bin\setrbvars.bat; WorkingDir: {%HOMEDRIVE}{%HOMEPATH}; IconFilename: {sys}\cmd.exe; Flags: createonlyiffileexists
Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe}