Corrected an issue in the Windows installer script that resulted in a spurious curly bracket being appended to paths when selecting a different installation directory.

git-svn-id: 4c7b768bc2e2a56aa1c56b1b5a9454ba68342430@6563 ac9c905b-388a-4ddf-9b6a-4063a022bc57

; Script generated by the Inno Setup Script Wizard.

#define MyAppName "Logtalk"
#define MyAppVerName "Logtalk 2.44.1"
#define MyAppPublisher "Logtalk.org"
#define MyAppURL "http://logtalk.org"
#define MyAppUrlName "Logtalk Web Site.url"
#define MyAppRegURL "http://logtalk.org/regform.html"
#define MyAppRegUrlName "Logtalk Registration.url"

#define MyBaseDir "C:\lgtsvn"

[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesEnvironment=yes
ChangesAssociations=yes
DefaultDirName={pf}\Logtalk
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile={#MyBaseDir}\LICENSE.txt
InfoBeforeFile={#MyBaseDir}\README.txt
OutputBaseFilename=lgt2441
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none

VersionInfoVersion=2.44.1
VersionInfoCopyright= Paulo Moura, Copyright (c) 1998-2012

AllowRootDirectory=yes
UninstallFilesDir="{userdocs}\Logtalk uninstaller"

MinVersion=0,5.0

[Types]
Name: "full"; Description: "Full installation"
Name: "base"; Description: "Base system installation"
Name: "user"; Description: "User files installation"
Name: "prolog"; Description: "Prolog integration shortcuts"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "base"; Description: "Base system (compiler/runtime, Prolog integration files, manuals)"; Types: full base custom; Flags: disablenouninstallwarning
Name: "user"; Description: "User files (libraries, examples, and other support files)"; Types: full user custom; Flags: checkablealone disablenouninstallwarning
Name: "user\backup"; Description: "Backup current Logtalk user folder"; Types: full user custom; Flags: disablenouninstallwarning
Name: "prolog"; Description: "Prolog integration (back-end compiler support)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\bp"; Description: "B-Prolog integration (version 7.5#8 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\cxprolog"; Description: "CxProlog integration (version 0.97.5 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\eclipse"; Description: "ECLiPSe integration (version 6.0#141 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\gprolog"; Description: "GNU Prolog integration (version 1.4.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\lean"; Description: "Lean Prolog Prolog integration (version 2.19.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\sicstus"; Description: "SICStus Prolog integration (versions 3.12.x, 4.x)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swicon"; Description: "SWI-Prolog (console) integration (version 5.8.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swiwin"; Description: "SWI-Prolog (window) integration (version 5.8.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsb"; Description: "XSB integration (version 3.3 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsbmt"; Description: "XSB-MT integration (version 3.3 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\yap"; Description: "YAP integration (version 6.0.2 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning

[Tasks]
Name: registration; Description: "&Register {#MyAppName} (opens a web page; requires an Internet connection)"; Components: base
Name: shortcut; Description: "&Create a desktop shortcut to the Logtalk user folder"; Components: user

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

[Messages]
BeveledLabel=Logtalk 2.44.1  Paulo Moura, Copyright (c) 1998-2012

[Dirs]
Name: {code:GetLgtUserDir}; Components: user; Flags: uninsneveruninstall
Name: "{userdocs}\Logtalk uninstaller"

[Files]
Source: "{#MyBaseDir}\*"; Excludes: ".*"; DestDir: "{app}"; Components: base; Flags: ignoreversion recursesubdirs createallsubdirs

Source: "{#MyBaseDir}\contributions\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\contributions"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\examples\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\examples"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\libpaths\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\libpaths"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\library\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\library"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\xml\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\xml"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall

Source: "{#MyBaseDir}\settings.lgt"; DestDir: "{code:GetLgtUserDir}"; DestName: "settings.lgt"; Components: user; Flags: ignoreversion uninsneveruninstall
Source: "{#MyBaseDir}\VERSION.txt"; DestDir: "{code:GetLgtUserDir}"; DestName: "VERSION.txt"; Components: user; Flags: ignoreversion uninsneveruninstall

Source: "{#MyBaseDir}\scripts\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion; Check: IsAdminLoggedOn
Source: "{#MyBaseDir}\xml\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion; Check: IsAdminLoggedOn

[INI]
Filename: "{app}\{#MyAppUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppURL}"; Components: base
Filename: "{app}\{#MyAppRegUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppRegURL}"; Components: base

[Icons]
Name: "{group}\Bibliography"; Filename: "{app}\BIBLIOGRAPHY.bib"; Components: base
Name: "{group}\Documentation"; Filename: "{app}\manuals\index.html"; Components: base
Name: "{group}\License"; Filename: "{app}\LICENSE.txt"; Components: base
Name: "{group}\Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: base
Name: "{group}\Read Me"; Filename: "{app}\README.txt"; Components: base
Name: "{group}\Customization instructions"; Filename: "{app}\CUSTOMIZE.txt"; Components: base
Name: "{group}\Default settings"; Filename: "%LOGTALKUSER%\settings.lgt"; Components: base

Name: "{group}\Web Site"; Filename: "{#MyAppUrl}"; Components: base

Name: "{group}\Logtalk - B-Prolog"; Filename: "{code:GetBPExePath}"; Parameters: "-i ""$LOGTALKHOME/integration/logtalk_bp.pl"""; Comment: "Runs Logtalk with B-Prolog"; WorkingDir: "%CD%"; Components: prolog\bp; Flags: createonlyiffileexists

Name: "{group}\Logtalk - CxProlog"; Filename: "{code:GetCxExePath}"; Parameters: "--script ""%LOGTALKHOME%\\integration\\logtalk_cx.pl"""; Comment: "Runs Logtalk with CxProlog"; WorkingDir: "%CD%"; Components: prolog\cxprolog; Flags: createonlyiffileexists

Name: "{group}\Logtalk - ECLiPSe 6"; Filename: "{code:GetEclipse6ExePath}"; Parameters: "-b ""$LOGTALKHOME/integration/logtalk_eclipse6.pl"""; Comment: "Runs Logtalk with ECLiPSe 6"; WorkingDir: "%CD%"; Components: prolog\eclipse; Flags: createonlyiffileexists

Name: "{group}\Logtalk - GNU Prolog"; Filename: "{code:GetGPExePath}"; Parameters: "--init-goal ""['$LOGTALKHOME/integration/logtalk_gp.pl']"""; Comment: "Runs Logtalk with GNU Prolog"; WorkingDir: "%CD%"; Components: prolog\gprolog; Flags: createonlyiffileexists

Name: "{group}\Logtalk - Lean Prolog"; Filename: "{code:GetLeanPrologExePath}"; Parameters: """['$LOGTALKHOME/integration/logtalk_lean']"""; Comment: "Runs Logtalk with Lean Prolog"; WorkingDir: "%CD%"; Components: prolog\lean; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SICStus Prolog 3.12"; Filename: "{code:GetSP3ExePath}"; Parameters: "-l ""%LOGTALKHOME%\integration\logtalk_sicstus3.pl"""; Comment: "Runs Logtalk with SICStus Prolog 3.12"; WorkingDir: "%CD%"; Components: prolog\sicstus; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SICStus Prolog 4"; Filename: "{code:GetSP4ExePath}"; Parameters: "-l ""%LOGTALKHOME%\integration\logtalk_sicstus4.pl"""; Comment: "Runs Logtalk with SICStus Prolog 4"; WorkingDir: "%CD%"; Components: prolog\sicstus; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SWI-Prolog (console)"; Filename: "{code:GetSWIConExePath}"; Parameters: "-f ""%LOGTALKHOME%\integration\logtalk_swi.pl"""; Comment: "Runs Logtalk with SWI-Prolog"; WorkingDir: "%CD%"; Components: prolog\swicon; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SWI-Prolog (window)"; Filename: "{code:GetSWIWinExePath}"; Parameters: "-f ""%LOGTALKHOME%\integration\logtalk_swi.pl"""; Comment: "Runs Logtalk with SWI-Prolog"; WorkingDir: "%CD%"; Components: prolog\swiwin; Flags: createonlyiffileexists

Name: "{group}\Logtalk - XSB"; Filename: "{code:GetXSBExePath}"; Parameters: "-l -e ""['%LOGTALKHOME%\\integration\\logtalk_xsb.pl']."""; Comment: "Runs Logtalk with XSB"; WorkingDir: "%CD%"; Components: prolog\xsb; Flags: createonlyiffileexists

Name: "{group}\Logtalk - XSB-MT"; Filename: "{code:GetXSBMTExePath}"; Parameters: "-l -e ""['%LOGTALKHOME%\\integration\\logtalk_xsbmt.pl']."""; Comment: "Runs Logtalk with XSB-MT"; WorkingDir: "%CD%"; Components: prolog\xsbmt; Flags: createonlyiffileexists

Name: "{group}\Logtalk - YAP"; Filename: "{code:GetYAPExePath}"; Parameters: "-l ""$LOGTALKHOME/integration/logtalk_yap.pl"""; Comment: "Runs Logtalk with YAP"; WorkingDir: "%CD%"; Components: prolog\yap; Flags: createonlyiffileexists

Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Components: base

Name: "{code:GetLgtUserDir}\Bibliography"; Filename: "{app}\BIBLIOGRAPHY.bib"; Components: user
Name: "{code:GetLgtUserDir}\License"; Filename: "{app}\LICENSE.txt"; Components: user
Name: "{code:GetLgtUserDir}\Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: user
Name: "{code:GetLgtUserDir}\Read Me"; Filename: "{app}\README.txt"; Components: user
Name: "{code:GetLgtUserDir}\Customization instructions"; Filename: "{app}\CUSTOMIZE.txt"; Components: user
Name: "{code:GetLgtUserDir}\configs"; Filename: "{app}\configs"; Components: user
Name: "{code:GetLgtUserDir}\manuals"; Filename: "{app}\manuals"; Components: user
Name: "{code:GetLgtUserDir}\wenv"; Filename: "{app}\wenv"; Components: user

Name: "{userdesktop}\Logtalk user files"; Filename: "{code:GetLgtUserDir}"; Components: user; Tasks: shortcut

[Registry]
; admin users
Root: HKLM; Subkey: "Software\Logtalk"; ValueType: dword; ValueName: "Version"; ValueData: "2441"; Components: base; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKLM; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; Components: base; Flags: uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKLM; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; ValueType: string; ValueName: "Extension"; ValueData: ".lgt"; Components: base; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKCR; Subkey: ".lgt"; ValueType: string; ValueName: ""; ValueData: "LogtalkSourceFile"; Components: base; Flags: uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKCR; Subkey: "LogtalkSourceFile"; ValueType: string; ValueName: ""; ValueData: "Logtalk source file"; Components: base; Flags: uninsdeletekey; Check: IsAdminLoggedOn
; non-admin users
Root: HKCU; Subkey: "Software\Logtalk"; ValueType: dword; ValueName: "Version"; ValueData: "2441"; Components: base; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; Components: base; Flags: uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; ValueType: string; ValueName: "Extension"; ValueData: ".lgt"; Components: base; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\.lgt"; ValueType: string; ValueName: ""; ValueData: "LogtalkSourceFile"; Components: base; Flags: uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\LogtalkSourceFile"; ValueType: string; ValueName: ""; ValueData: "Logtalk source file"; Components: base; Flags: uninsdeletekey; Check: not IsAdminLoggedOn

[Run]
Filename: "{app}\RELEASE_NOTES.txt"; Description: "View the release notes"; Components: base; Flags: postinstall shellexec skipifsilent
Filename: "{app}\CUSTOMIZE.txt"; Description: "Read the customization instructions for completing your setup"; Components: base; Flags: postinstall shellexec skipifsilent

Filename: "{app}\{#MyAppRegUrlName}"; Components: base; Flags: shellexec nowait; Tasks: registration

[UninstallDelete]
Type: filesandordirs; Name: "{app}"; Components: base
Type: filesandordirs; Name: "{group}"; Components: base

[Code]
var
  LgtUserDirPage: TInputDirWizardPage;
  WarningPage, ErrorPage: TOutputMsgWizardPage;
  Explanation, Warning, Error, BackupFolder: String;

function GetLgtUserDir(Param: String): String;
begin
  Result := LgtUserDirPage.Values[0]
end;

function GetCurrentDate(Param: String): String;
begin
  Result := GetDateTimeString('dddddd tt', '-', '-')
end;

function ShouldSkipPage(PageID: Integer): Boolean;
var
  LOGTALKHOME: String;
begin
  if IsAdminLoggedOn then
    if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'LOGTALKHOME', LOGTALKHOME) then
      WizardForm.DirEdit.Text := LOGTALKHOME
    else
      WizardForm.DirEdit.Text := ExpandConstant('{pf}') + '\Logtalk'
  else if RegQueryStringValue(HKCU, 'Environment', 'LOGTALKHOME', LOGTALKHOME) then
    WizardForm.DirEdit.Text := LOGTALKHOME
  else
    WizardForm.DirEdit.Text := ExpandConstant('{localappdata}') + '\Logtalk';
  Result := false
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
  NewFolder: String;
begin
  NewFolder := LgtUserDirPage.Values[0];
  if (CurStep = ssInstall) and DirExists(NewFolder) and (pos('backup', WizardSelectedComponents(False)) > 0) then begin
    BackupFolder := NewFolder + '-backup-' + GetDateTimeString('yyyy-mm-dd-hhnnss', '-', ':');
    RenameFile(NewFolder, BackupFolder)
  end
  else if (CurStep = ssPostInstall) and FileExists(BackupFolder + '\settings.lgt') then begin
    RenameFile(NewFolder + '\settings.lgt', NewFolder + '\settings-pristine.lgt');
    FileCopy(BackupFolder + '\settings.lgt', NewFolder + '\settings.lgt', False)
  end
end;

function BPExePath: String;
var
  BPDIR: String;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\', 'BPDIR', BPDIR) then
    Result := BPDIR + '\bp.bat'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetBPExePath(Param: String): String;
var
  Warning: String;
begin
  Result := BPExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect B-Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	  MsgBox(Warning, mbError, MB_OK);
  end
end;

function CxExePath: String;
var
  CxDir: String;
begin
  if RegQueryStringValue(HKLM, 'SOFTWARE\CxProlog\', 'CXPROLOG_DIR', CxDir) then
    Result := CxDir + '\cxprolog.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetCxExePath(Param: String): String;
var
  Warning: String;
begin
  Result := CxExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect CxProlog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function Eclipse6ExePath: String;
var
  ECLIPSEDIR: String;
begin
  if IsWin64 then
    if RegQueryStringValue(HKLM64, 'Software\IC-Parc\Eclipse\6.1\', 'ECLIPSEDIR', ECLIPSEDIR) then
        Result := ECLIPSEDIR + '\lib\x86_64_nt\eclipse.exe'
    else if RegQueryStringValue(HKLM32, 'Software\IC-Parc\Eclipse\6.1\', 'ECLIPSEDIR', ECLIPSEDIR) then
        Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
    else if RegQueryStringValue(HKLM32, 'Software\IC-Parc\Eclipse\6.0\', 'ECLIPSEDIR', ECLIPSEDIR) then
      Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else if RegQueryStringValue(HKLM, 'Software\IC-Parc\Eclipse\6.1\', 'ECLIPSEDIR', ECLIPSEDIR) then
         Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
       else if RegQueryStringValue(HKLM, 'Software\IC-Parc\Eclipse\6.0\', 'ECLIPSEDIR', ECLIPSEDIR) then
         Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
       else
         Result := 'prolog_compiler_not_installed'
end;

function GetEclipse6ExePath(Param: String): String;
var
  Warning: String;
begin
  Result := Eclipse6ExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect ECLiPSe Prolog 6 installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
    MsgBox(Warning, mbError, MB_OK);
  end
end;

function GPExePath: String;
var
  RootPath: String;
begin
  if RegQueryStringValue(HKCU, 'Software\GnuProlog\', 'RootPath', RootPath) then
    Result := RootPath + '\bin\gprolog.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetGPExePath(Param: String): String;
var
  Warning: String;
begin
  Result := GPExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect GNU Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
    MsgBox(Warning, mbError, MB_OK);
  end
end;

function LeanPrologExePath: String;
begin
  if FileExists(ExpandConstant('{pf}') + '\LeanProlog\lprolog.bat') then
    Result := ExpandConstant('{pf}') + '\LeanProlog\lprolog.bat'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetLeanPrologExePath(Param: String): String;
var
  Warning: String;
begin
  Result := LeanPrologExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect Lean Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
    MsgBox(Warning, mbError, MB_OK);
  end
end;

function SP3ExePath: String;
var
  SP_PATH: String;
begin
  if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus3.12_win32\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetSP3ExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SP3ExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SICStus Prolog 3 installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function SP4ExePath: String;
var
  SP_PATH: String;
begin
  if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus4.2_x86-win32-nt-4\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus4.1_x86-win32-nt-4\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus4.0_win32\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetSP4ExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SP4ExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SICStus Prolog 4 installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function SWIConExePath: String;
var
  Home: String;
begin
  if RegQueryStringValue(HKLM, 'Software\SWI\Prolog64\', 'home', Home) then
    if FileExists(Home + '\bin\plcon.exe') then
      Result := Home + '\bin\plcon.exe'
    else if FileExists(Home + '\bin\swipl.exe') then
      Result := Home + '\bin\swipl.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else
      Result := 'prolog_compiler_not_installed';
  if (Result = 'prolog_compiler_not_installed') and RegQueryStringValue(HKLM, 'Software\SWI\Prolog\', 'home', Home) then
    if FileExists(Home + '\bin\plcon.exe') then
      Result := Home + '\bin\plcon.exe'
    else if FileExists(Home + '\bin\swipl.exe') then
      Result := Home + '\bin\swipl.exe'
    else
      Result := 'prolog_compiler_not_installed'
end;

function GetSWIConExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SWIConExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SWI-Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK)
  end
end;

function SWIWinExePath: String;
var
  Home: String;
begin
  if RegQueryStringValue(HKLM, 'Software\SWI\Prolog64\', 'home', Home) then
    if FileExists(Home + '\bin\plwin.exe') then
      Result := Home + '\bin\plwin.exe'
    else if FileExists(Home + '\bin\swipl-win.exe') then
      Result := Home + '\bin\swipl-win.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else
      Result := 'prolog_compiler_not_installed';
  if (Result = 'prolog_compiler_not_installed') and RegQueryStringValue(HKLM, 'Software\SWI\Prolog\', 'home', Home) then
    if FileExists(Home + '\bin\plwin.exe') then
      Result := Home + '\bin\plwin.exe'
    else if FileExists(Home + '\bin\swipl-win.exe') then
      Result := Home + '\bin\swipl-win.exe'
    else
      Result := 'prolog_compiler_not_installed'
end;

function GetSWIWinExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SWIWinExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SWI-Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK)
  end
end;

function XSBExePath: String;
var
  XSB_DIR: String;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\', 'XSB_DIR', XSB_DIR) then
    Result := XSB_DIR + '\config\i686-pc-cygwin\bin\xsb.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetXSBExePath(Param: String): String;
var
  Warning: String;
begin
  Result := XSBExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect XSB installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function XSBMTExePath: String;
var
  XSB_DIR: String;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\', 'XSB_DIR', XSB_DIR) then
    Result := XSB_DIR + '\config\i686-pc-cygwin-mt\bin\xsb.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetXSBMTExePath(Param: String): String;
var
  Warning: String;
begin
  Result := XSBMTExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect XSB-MT installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function YAPExePath: String;
var
  Home: String;
begin
  if IsWin64 then
    if RegQueryStringValue(HKLM64, 'Software\YAP\Prolog64\', 'home', Home) then
      Result := Home + '\bin\yap.exe'
    else if RegQueryStringValue(HKLM32, 'Software\YAP\Prolog64\', 'home', Home) then
      Result := Home + '\bin\yap.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else if RegQueryStringValue(HKLM, 'Software\YAP\Prolog\', 'home', Home) then
    Result := Home + '\bin\yap.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetYAPExePath(Param: String): String;
var
  Warning: String;
begin
  Result := YAPExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect YAP installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function NoBackEndPrologCompilerInstalled: Boolean;
begin
    Result :=
      (BPExePath = 'prolog_compiler_not_installed') and
      (CxExePath = 'prolog_compiler_not_installed') and
      (Eclipse6ExePath = 'prolog_compiler_not_installed') and
      (GPExePath = 'prolog_compiler_not_installed') and
      (SP3ExePath = 'prolog_compiler_not_installed') and
      (SP4ExePath = 'prolog_compiler_not_installed') and
      (SWIConExePath = 'prolog_compiler_not_installed') and
      (SWIWinExePath = 'prolog_compiler_not_installed') and
      (XSBExePath = 'prolog_compiler_not_installed') and
      (XSBMTExePath = 'prolog_compiler_not_installed') and
      (YAPExePath = 'prolog_compiler_not_installed')
end;

procedure InitializeWizard;
var
  Version, InstalledVersion: Cardinal;
  LOGTALKHOME, LOGTALKUSER: String;
begin
  Explanation := 'Select the folder in which Setup should install Logtalk user files, then click Next.'
                 + Chr(13) + Chr(13)
                 + 'These files allows each user to independently customize Logtalk and to freely modify the provided libraries, programming examples, and other supporting files.'
                 + Chr(13) + Chr(13)
                 + 'A copy of these files must exist in the user home folder in order to use the Logtalk-Prolog integration scripts available from the Start Menu program group "Logtalk".'
                 + Chr(13) + Chr(13)
                 + 'Addtional end-users may use this installer to make a copy of these files on their home folders after a full installation of Logtalk.';
  LgtUserDirPage := CreateInputDirPage(wpSelectDir,
    'Select folder for Logtalk user files', 'Where should Logtalk user files be installed?',
    Explanation,
    False, 'New Folder');
  LgtUserDirPage.Add('');
  if RegQueryStringValue(HKCU, 'Environment', 'LOGTALKUSER', LOGTALKUSER) then
    LgtUserDirPage.Values[0] := LOGTALKUSER
  else
    LgtUserDirPage.Values[0] := ExpandConstant('{userdocs}') + '\Logtalk';
  if not IsAdminLoggedOn and RegQueryDWordValue(HKLM, 'Software\Logtalk', 'Version', Version) then
  begin
    Warning := 'You are running this installer from a non-administrative account.'
               + Chr(13) + Chr(13)
               + 'The base Logtalk system is already installed by an administrator. You may simply setup Logtalk for you as an end-user by choosing to install only the user-level files. In alternative, you may perform a full installation.'
               + Chr(13) + Chr(13)
               + 'If Logtalk is already set for you, this installer will make a backup copy of your current files (if you choose the same installation folder) and will restore all user files to their default, pristine state.';
    WarningPage := CreateOutputMsgPage(wpWelcome, 'Information', 'Please read the following important information before continuing.', Warning);
  end;
  if RegQueryDWordValue(HKCU, 'Software\Logtalk', 'Version', Version) then
    InstalledVersion := Version
  else if RegQueryDWordValue(HKLM, 'Software\Logtalk', 'Version', Version) then
    InstalledVersion := Version
  else if RegQueryStringValue(HKCU, 'Environment', 'LOGTALKHOME', LOGTALKHOME) and DirExists(LOGTALKHOME) then
    InstalledVersion := 0
  else if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'LOGTALKHOME', LOGTALKHOME) and DirExists(LOGTALKHOME) then
    InstalledVersion := 0
  else
    InstalledVersion := -1;
  if (InstalledVersion >= 0) and (InstalledVersion < 2440) then
  begin
    Warning := 'Your Logtalk user directory is outdated!'
               + Chr(13) + Chr(13)
               + 'You must updade your Logtalk user folder by performing a full installation.'
               + Chr(13) + Chr(13)
               + 'All aditional Logtalk users on your computer must also use this installer to update their Logtalk user folders.';
    WarningPage := CreateOutputMsgPage(wpWelcome, 'Warning', 'Logtalk user folder update required.', Warning)
  end;
  if NoBackEndPrologCompilerInstalled then
  begin
    Error := 'No compatible Prolog compiler found!'
             + Chr(13) + Chr(13)
             + 'Logtalk requires a compatible Prolog compiler to be installed in order to run. Logtalk uses a Prolog compiler as a back-end compiler.'
             + Chr(13) + Chr(13)
             + 'You must rerun the Logtalk installer after installing a compatible Prolog compiler.';
    ErrorPage := CreateOutputMsgPage(wpSelectDir, 'Warning', 'No compatible Prolog compiler found!', Error)
  end
end;

; Script generated by the Inno Setup Script Wizard.

#define MyAppName "Logtalk"
#define MyAppVerName "Logtalk 2.44.1"
#define MyAppPublisher "Logtalk.org"
#define MyAppURL "http://logtalk.org"
#define MyAppUrlName "Logtalk Web Site.url"
#define MyAppRegURL "http://logtalk.org/regform.html"
#define MyAppRegUrlName "Logtalk Registration.url"

#define MyBaseDir "C:\lgtsvn"

[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesEnvironment=yes
ChangesAssociations=yes
DefaultDirName={{pf}\Logtalk}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile={#MyBaseDir}\LICENSE.txt
InfoBeforeFile={#MyBaseDir}\README.txt
OutputBaseFilename=lgt2441
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none

VersionInfoVersion=2.44.1
VersionInfoCopyright= Paulo Moura, Copyright (c) 1998-2012

AllowRootDirectory=yes
UninstallFilesDir="{userdocs}\Logtalk uninstaller"

MinVersion=0,5.0

[Types]
Name: "full"; Description: "Full installation"
Name: "base"; Description: "Base system installation"
Name: "user"; Description: "User files installation"
Name: "prolog"; Description: "Prolog integration shortcuts"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "base"; Description: "Base system (compiler/runtime, Prolog integration files, manuals)"; Types: full base custom; Flags: disablenouninstallwarning
Name: "user"; Description: "User files (libraries, examples, and other support files)"; Types: full user custom; Flags: checkablealone disablenouninstallwarning
Name: "user\backup"; Description: "Backup current Logtalk user folder"; Types: full user custom; Flags: disablenouninstallwarning
Name: "prolog"; Description: "Prolog integration (back-end compiler support)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\bp"; Description: "B-Prolog integration (version 7.5#8 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\cxprolog"; Description: "CxProlog integration (version 0.97.5 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\eclipse"; Description: "ECLiPSe integration (version 6.0#141 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\gprolog"; Description: "GNU Prolog integration (version 1.4.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\lean"; Description: "Lean Prolog Prolog integration (version 2.19.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\sicstus"; Description: "SICStus Prolog integration (versions 3.12.x, 4.x)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swicon"; Description: "SWI-Prolog (console) integration (version 5.8.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swiwin"; Description: "SWI-Prolog (window) integration (version 5.8.0 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsb"; Description: "XSB integration (version 3.3 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsbmt"; Description: "XSB-MT integration (version 3.3 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\yap"; Description: "YAP integration (version 6.0.2 or later)"; Types: full prolog custom; Flags: disablenouninstallwarning

[Tasks]
Name: registration; Description: "&Register {#MyAppName} (opens a web page; requires an Internet connection)"; Components: base
Name: shortcut; Description: "&Create a desktop shortcut to the Logtalk user folder"; Components: user

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

[Messages]
BeveledLabel=Logtalk 2.44.1  Paulo Moura, Copyright (c) 1998-2012

[Dirs]
Name: {code:GetLgtUserDir}; Components: user; Flags: uninsneveruninstall
Name: "{userdocs}\Logtalk uninstaller"

[Files]
Source: "{#MyBaseDir}\*"; Excludes: ".*"; DestDir: "{app}"; Components: base; Flags: ignoreversion recursesubdirs createallsubdirs

Source: "{#MyBaseDir}\contributions\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\contributions"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\examples\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\examples"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\libpaths\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\libpaths"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\library\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\library"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "{#MyBaseDir}\xml\*"; Excludes: ".*"; DestDir: "{code:GetLgtUserDir}\xml"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall

Source: "{#MyBaseDir}\settings.lgt"; DestDir: "{code:GetLgtUserDir}"; DestName: "settings.lgt"; Components: user; Flags: ignoreversion uninsneveruninstall
Source: "{#MyBaseDir}\VERSION.txt"; DestDir: "{code:GetLgtUserDir}"; DestName: "VERSION.txt"; Components: user; Flags: ignoreversion uninsneveruninstall

Source: "{#MyBaseDir}\scripts\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion; Check: IsAdminLoggedOn
Source: "{#MyBaseDir}\xml\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion; Check: IsAdminLoggedOn

[INI]
Filename: "{app}\{#MyAppUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppURL}"; Components: base
Filename: "{app}\{#MyAppRegUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppRegURL}"; Components: base

[Icons]
Name: "{group}\Bibliography"; Filename: "{app}\BIBLIOGRAPHY.bib"; Components: base
Name: "{group}\Documentation"; Filename: "{app}\manuals\index.html"; Components: base
Name: "{group}\License"; Filename: "{app}\LICENSE.txt"; Components: base
Name: "{group}\Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: base
Name: "{group}\Read Me"; Filename: "{app}\README.txt"; Components: base
Name: "{group}\Customization instructions"; Filename: "{app}\CUSTOMIZE.txt"; Components: base
Name: "{group}\Default settings"; Filename: "%LOGTALKUSER%\settings.lgt"; Components: base

Name: "{group}\Web Site"; Filename: "{#MyAppUrl}"; Components: base

Name: "{group}\Logtalk - B-Prolog"; Filename: "{code:GetBPExePath}"; Parameters: "-i ""$LOGTALKHOME/integration/logtalk_bp.pl"""; Comment: "Runs Logtalk with B-Prolog"; WorkingDir: "%CD%"; Components: prolog\bp; Flags: createonlyiffileexists

Name: "{group}\Logtalk - CxProlog"; Filename: "{code:GetCxExePath}"; Parameters: "--script ""%LOGTALKHOME%\\integration\\logtalk_cx.pl"""; Comment: "Runs Logtalk with CxProlog"; WorkingDir: "%CD%"; Components: prolog\cxprolog; Flags: createonlyiffileexists

Name: "{group}\Logtalk - ECLiPSe 6"; Filename: "{code:GetEclipse6ExePath}"; Parameters: "-b ""$LOGTALKHOME/integration/logtalk_eclipse6.pl"""; Comment: "Runs Logtalk with ECLiPSe 6"; WorkingDir: "%CD%"; Components: prolog\eclipse; Flags: createonlyiffileexists

Name: "{group}\Logtalk - GNU Prolog"; Filename: "{code:GetGPExePath}"; Parameters: "--init-goal ""['$LOGTALKHOME/integration/logtalk_gp.pl']"""; Comment: "Runs Logtalk with GNU Prolog"; WorkingDir: "%CD%"; Components: prolog\gprolog; Flags: createonlyiffileexists

Name: "{group}\Logtalk - Lean Prolog"; Filename: "{code:GetLeanPrologExePath}"; Parameters: """['$LOGTALKHOME/integration/logtalk_lean']"""; Comment: "Runs Logtalk with Lean Prolog"; WorkingDir: "%CD%"; Components: prolog\lean; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SICStus Prolog 3.12"; Filename: "{code:GetSP3ExePath}"; Parameters: "-l ""%LOGTALKHOME%\integration\logtalk_sicstus3.pl"""; Comment: "Runs Logtalk with SICStus Prolog 3.12"; WorkingDir: "%CD%"; Components: prolog\sicstus; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SICStus Prolog 4"; Filename: "{code:GetSP4ExePath}"; Parameters: "-l ""%LOGTALKHOME%\integration\logtalk_sicstus4.pl"""; Comment: "Runs Logtalk with SICStus Prolog 4"; WorkingDir: "%CD%"; Components: prolog\sicstus; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SWI-Prolog (console)"; Filename: "{code:GetSWIConExePath}"; Parameters: "-f ""%LOGTALKHOME%\integration\logtalk_swi.pl"""; Comment: "Runs Logtalk with SWI-Prolog"; WorkingDir: "%CD%"; Components: prolog\swicon; Flags: createonlyiffileexists

Name: "{group}\Logtalk - SWI-Prolog (window)"; Filename: "{code:GetSWIWinExePath}"; Parameters: "-f ""%LOGTALKHOME%\integration\logtalk_swi.pl"""; Comment: "Runs Logtalk with SWI-Prolog"; WorkingDir: "%CD%"; Components: prolog\swiwin; Flags: createonlyiffileexists

Name: "{group}\Logtalk - XSB"; Filename: "{code:GetXSBExePath}"; Parameters: "-l -e ""['%LOGTALKHOME%\\integration\\logtalk_xsb.pl']."""; Comment: "Runs Logtalk with XSB"; WorkingDir: "%CD%"; Components: prolog\xsb; Flags: createonlyiffileexists

Name: "{group}\Logtalk - XSB-MT"; Filename: "{code:GetXSBMTExePath}"; Parameters: "-l -e ""['%LOGTALKHOME%\\integration\\logtalk_xsbmt.pl']."""; Comment: "Runs Logtalk with XSB-MT"; WorkingDir: "%CD%"; Components: prolog\xsbmt; Flags: createonlyiffileexists

Name: "{group}\Logtalk - YAP"; Filename: "{code:GetYAPExePath}"; Parameters: "-l ""$LOGTALKHOME/integration/logtalk_yap.pl"""; Comment: "Runs Logtalk with YAP"; WorkingDir: "%CD%"; Components: prolog\yap; Flags: createonlyiffileexists

Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Components: base

Name: "{code:GetLgtUserDir}\Bibliography"; Filename: "{app}\BIBLIOGRAPHY.bib"; Components: user
Name: "{code:GetLgtUserDir}\License"; Filename: "{app}\LICENSE.txt"; Components: user
Name: "{code:GetLgtUserDir}\Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: user
Name: "{code:GetLgtUserDir}\Read Me"; Filename: "{app}\README.txt"; Components: user
Name: "{code:GetLgtUserDir}\Customization instructions"; Filename: "{app}\CUSTOMIZE.txt"; Components: user
Name: "{code:GetLgtUserDir}\configs"; Filename: "{app}\configs"; Components: user
Name: "{code:GetLgtUserDir}\manuals"; Filename: "{app}\manuals"; Components: user
Name: "{code:GetLgtUserDir}\wenv"; Filename: "{app}\wenv"; Components: user

Name: "{userdesktop}\Logtalk user files"; Filename: "{code:GetLgtUserDir}"; Components: user; Tasks: shortcut

[Registry]
; admin users
Root: HKLM; Subkey: "Software\Logtalk"; ValueType: dword; ValueName: "Version"; ValueData: "2441"; Components: base; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKLM; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; Components: base; Flags: uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKLM; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; ValueType: string; ValueName: "Extension"; ValueData: ".lgt"; Components: base; Flags: deletevalue uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKCR; Subkey: ".lgt"; ValueType: string; ValueName: ""; ValueData: "LogtalkSourceFile"; Components: base; Flags: uninsdeletevalue; Check: IsAdminLoggedOn
Root: HKCR; Subkey: "LogtalkSourceFile"; ValueType: string; ValueName: ""; ValueData: "Logtalk source file"; Components: base; Flags: uninsdeletekey; Check: IsAdminLoggedOn
; non-admin users
Root: HKCU; Subkey: "Software\Logtalk"; ValueType: dword; ValueName: "Version"; ValueData: "2441"; Components: base; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; Components: base; Flags: uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\MIME\Database\Content Type\text/x-logtalk"; ValueType: string; ValueName: "Extension"; ValueData: ".lgt"; Components: base; Flags: deletevalue uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\.lgt"; ValueType: string; ValueName: ""; ValueData: "LogtalkSourceFile"; Components: base; Flags: uninsdeletevalue; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: "SOFTWARE\Classes\LogtalkSourceFile"; ValueType: string; ValueName: ""; ValueData: "Logtalk source file"; Components: base; Flags: uninsdeletekey; Check: not IsAdminLoggedOn

[Run]
Filename: "{app}\RELEASE_NOTES.txt"; Description: "View the release notes"; Components: base; Flags: postinstall shellexec skipifsilent
Filename: "{app}\CUSTOMIZE.txt"; Description: "Read the customization instructions for completing your setup"; Components: base; Flags: postinstall shellexec skipifsilent

Filename: "{app}\{#MyAppRegUrlName}"; Components: base; Flags: shellexec nowait; Tasks: registration

[UninstallDelete]
Type: filesandordirs; Name: "{app}"; Components: base
Type: filesandordirs; Name: "{group}"; Components: base

[Code]
var
  LgtUserDirPage: TInputDirWizardPage;
  WarningPage, ErrorPage: TOutputMsgWizardPage;
  Explanation, Warning, Error, BackupFolder: String;

function GetLgtUserDir(Param: String): String;
begin
  Result := LgtUserDirPage.Values[0]
end;

function GetCurrentDate(Param: String): String;
begin
  Result := GetDateTimeString('dddddd tt', '-', '-')
end;

function ShouldSkipPage(PageID: Integer): Boolean;
var
  LOGTALKHOME: String;
begin
  if IsAdminLoggedOn then
    if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'LOGTALKHOME', LOGTALKHOME) then
      WizardForm.DirEdit.Text := LOGTALKHOME
    else
      WizardForm.DirEdit.Text := ExpandConstant('{pf}') + '\Logtalk'
  else if RegQueryStringValue(HKCU, 'Environment', 'LOGTALKHOME', LOGTALKHOME) then
    WizardForm.DirEdit.Text := LOGTALKHOME
  else
    WizardForm.DirEdit.Text := ExpandConstant('{localappdata}') + '\Logtalk';
  Result := false
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
  NewFolder: String;
begin
  NewFolder := LgtUserDirPage.Values[0];
  if (CurStep = ssInstall) and DirExists(NewFolder) and (pos('backup', WizardSelectedComponents(False)) > 0) then begin
    BackupFolder := NewFolder + '-backup-' + GetDateTimeString('yyyy-mm-dd-hhnnss', '-', ':');
    RenameFile(NewFolder, BackupFolder)
  end
  else if (CurStep = ssPostInstall) and FileExists(BackupFolder + '\settings.lgt') then begin
    RenameFile(NewFolder + '\settings.lgt', NewFolder + '\settings-pristine.lgt');
    FileCopy(BackupFolder + '\settings.lgt', NewFolder + '\settings.lgt', False)
  end
end;

function BPExePath: String;
var
  BPDIR: String;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\', 'BPDIR', BPDIR) then
    Result := BPDIR + '\bp.bat'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetBPExePath(Param: String): String;
var
  Warning: String;
begin
  Result := BPExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect B-Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	  MsgBox(Warning, mbError, MB_OK);
  end
end;

function CxExePath: String;
var
  CxDir: String;
begin
  if RegQueryStringValue(HKLM, 'SOFTWARE\CxProlog\', 'CXPROLOG_DIR', CxDir) then
    Result := CxDir + '\cxprolog.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetCxExePath(Param: String): String;
var
  Warning: String;
begin
  Result := CxExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect CxProlog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function Eclipse6ExePath: String;
var
  ECLIPSEDIR: String;
begin
  if IsWin64 then
    if RegQueryStringValue(HKLM64, 'Software\IC-Parc\Eclipse\6.1\', 'ECLIPSEDIR', ECLIPSEDIR) then
        Result := ECLIPSEDIR + '\lib\x86_64_nt\eclipse.exe'
    else if RegQueryStringValue(HKLM32, 'Software\IC-Parc\Eclipse\6.1\', 'ECLIPSEDIR', ECLIPSEDIR) then
        Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
    else if RegQueryStringValue(HKLM32, 'Software\IC-Parc\Eclipse\6.0\', 'ECLIPSEDIR', ECLIPSEDIR) then
      Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else if RegQueryStringValue(HKLM, 'Software\IC-Parc\Eclipse\6.1\', 'ECLIPSEDIR', ECLIPSEDIR) then
         Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
       else if RegQueryStringValue(HKLM, 'Software\IC-Parc\Eclipse\6.0\', 'ECLIPSEDIR', ECLIPSEDIR) then
         Result := ECLIPSEDIR + '\lib\i386_nt\eclipse.exe'
       else
         Result := 'prolog_compiler_not_installed'
end;

function GetEclipse6ExePath(Param: String): String;
var
  Warning: String;
begin
  Result := Eclipse6ExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect ECLiPSe Prolog 6 installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
    MsgBox(Warning, mbError, MB_OK);
  end
end;

function GPExePath: String;
var
  RootPath: String;
begin
  if RegQueryStringValue(HKCU, 'Software\GnuProlog\', 'RootPath', RootPath) then
    Result := RootPath + '\bin\gprolog.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetGPExePath(Param: String): String;
var
  Warning: String;
begin
  Result := GPExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect GNU Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
    MsgBox(Warning, mbError, MB_OK);
  end
end;

function LeanPrologExePath: String;
begin
  if FileExists(ExpandConstant('{pf}') + '\LeanProlog\lprolog.bat') then
    Result := ExpandConstant('{pf}') + '\LeanProlog\lprolog.bat'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetLeanPrologExePath(Param: String): String;
var
  Warning: String;
begin
  Result := LeanPrologExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect Lean Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
    MsgBox(Warning, mbError, MB_OK);
  end
end;

function SP3ExePath: String;
var
  SP_PATH: String;
begin
  if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus3.12_win32\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetSP3ExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SP3ExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SICStus Prolog 3 installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function SP4ExePath: String;
var
  SP_PATH: String;
begin
  if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus4.2_x86-win32-nt-4\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus4.1_x86-win32-nt-4\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else if RegQueryStringValue(HKLM32, 'Software\SICS\SICStus4.0_win32\', 'SP_PATH', SP_PATH) then
    Result := SP_PATH + '\bin\spwin.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetSP4ExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SP4ExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SICStus Prolog 4 installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function SWIConExePath: String;
var
  Home: String;
begin
  if RegQueryStringValue(HKLM, 'Software\SWI\Prolog64\', 'home', Home) then
    if FileExists(Home + '\bin\plcon.exe') then
      Result := Home + '\bin\plcon.exe'
    else if FileExists(Home + '\bin\swipl.exe') then
      Result := Home + '\bin\swipl.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else
      Result := 'prolog_compiler_not_installed';
  if (Result = 'prolog_compiler_not_installed') and RegQueryStringValue(HKLM, 'Software\SWI\Prolog\', 'home', Home) then
    if FileExists(Home + '\bin\plcon.exe') then
      Result := Home + '\bin\plcon.exe'
    else if FileExists(Home + '\bin\swipl.exe') then
      Result := Home + '\bin\swipl.exe'
    else
      Result := 'prolog_compiler_not_installed'
end;

function GetSWIConExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SWIConExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SWI-Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK)
  end
end;

function SWIWinExePath: String;
var
  Home: String;
begin
  if RegQueryStringValue(HKLM, 'Software\SWI\Prolog64\', 'home', Home) then
    if FileExists(Home + '\bin\plwin.exe') then
      Result := Home + '\bin\plwin.exe'
    else if FileExists(Home + '\bin\swipl-win.exe') then
      Result := Home + '\bin\swipl-win.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else
      Result := 'prolog_compiler_not_installed';
  if (Result = 'prolog_compiler_not_installed') and RegQueryStringValue(HKLM, 'Software\SWI\Prolog\', 'home', Home) then
    if FileExists(Home + '\bin\plwin.exe') then
      Result := Home + '\bin\plwin.exe'
    else if FileExists(Home + '\bin\swipl-win.exe') then
      Result := Home + '\bin\swipl-win.exe'
    else
      Result := 'prolog_compiler_not_installed'
end;

function GetSWIWinExePath(Param: String): String;
var
  Warning: String;
begin
  Result := SWIWinExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect SWI-Prolog installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK)
  end
end;

function XSBExePath: String;
var
  XSB_DIR: String;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\', 'XSB_DIR', XSB_DIR) then
    Result := XSB_DIR + '\config\i686-pc-cygwin\bin\xsb.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetXSBExePath(Param: String): String;
var
  Warning: String;
begin
  Result := XSBExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect XSB installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function XSBMTExePath: String;
var
  XSB_DIR: String;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\', 'XSB_DIR', XSB_DIR) then
    Result := XSB_DIR + '\config\i686-pc-cygwin-mt\bin\xsb.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetXSBMTExePath(Param: String): String;
var
  Warning: String;
begin
  Result := XSBMTExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect XSB-MT installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function YAPExePath: String;
var
  Home: String;
begin
  if IsWin64 then
    if RegQueryStringValue(HKLM64, 'Software\YAP\Prolog64\', 'home', Home) then
      Result := Home + '\bin\yap.exe'
    else if RegQueryStringValue(HKLM32, 'Software\YAP\Prolog64\', 'home', Home) then
      Result := Home + '\bin\yap.exe'
    else
      Result := 'prolog_compiler_not_installed'
  else if RegQueryStringValue(HKLM, 'Software\YAP\Prolog\', 'home', Home) then
    Result := Home + '\bin\yap.exe'
  else
    Result := 'prolog_compiler_not_installed'
end;

function GetYAPExePath(Param: String): String;
var
  Warning: String;
begin
  Result := YAPExePath;
  if Result = 'prolog_compiler_not_installed' then
  begin
    Warning := 'Failed to detect YAP installation.' + Chr(13) + 'Logtalk integration shortcut not created.';
	MsgBox(Warning, mbError, MB_OK);
  end
end;

function NoBackEndPrologCompilerInstalled: Boolean;
begin
    Result :=
      (BPExePath = 'prolog_compiler_not_installed') and
      (CxExePath = 'prolog_compiler_not_installed') and
      (Eclipse6ExePath = 'prolog_compiler_not_installed') and
      (GPExePath = 'prolog_compiler_not_installed') and
      (SP3ExePath = 'prolog_compiler_not_installed') and
      (SP4ExePath = 'prolog_compiler_not_installed') and
      (SWIConExePath = 'prolog_compiler_not_installed') and
      (SWIWinExePath = 'prolog_compiler_not_installed') and
      (XSBExePath = 'prolog_compiler_not_installed') and
      (XSBMTExePath = 'prolog_compiler_not_installed') and
      (YAPExePath = 'prolog_compiler_not_installed')
end;

procedure InitializeWizard;
var
  Version, InstalledVersion: Cardinal;
  LOGTALKHOME, LOGTALKUSER: String;
begin
  Explanation := 'Select the folder in which Setup should install Logtalk user files, then click Next.'
                 + Chr(13) + Chr(13)
                 + 'These files allows each user to independently customize Logtalk and to freely modify the provided libraries, programming examples, and other supporting files.'
                 + Chr(13) + Chr(13)
                 + 'A copy of these files must exist in the user home folder in order to use the Logtalk-Prolog integration scripts available from the Start Menu program group "Logtalk".'
                 + Chr(13) + Chr(13)
                 + 'Addtional end-users may use this installer to make a copy of these files on their home folders after a full installation of Logtalk.';
  LgtUserDirPage := CreateInputDirPage(wpSelectDir,
    'Select folder for Logtalk user files', 'Where should Logtalk user files be installed?',
    Explanation,
    False, 'New Folder');
  LgtUserDirPage.Add('');
  if RegQueryStringValue(HKCU, 'Environment', 'LOGTALKUSER', LOGTALKUSER) then
    LgtUserDirPage.Values[0] := LOGTALKUSER
  else
    LgtUserDirPage.Values[0] := ExpandConstant('{userdocs}') + '\Logtalk';
  if not IsAdminLoggedOn and RegQueryDWordValue(HKLM, 'Software\Logtalk', 'Version', Version) then
  begin
    Warning := 'You are running this installer from a non-administrative account.'
               + Chr(13) + Chr(13)
               + 'The base Logtalk system is already installed by an administrator. You may simply setup Logtalk for you as an end-user by choosing to install only the user-level files. In alternative, you may perform a full installation.'
               + Chr(13) + Chr(13)
               + 'If Logtalk is already set for you, this installer will make a backup copy of your current files (if you choose the same installation folder) and will restore all user files to their default, pristine state.';
    WarningPage := CreateOutputMsgPage(wpWelcome, 'Information', 'Please read the following important information before continuing.', Warning);
  end;
  if RegQueryDWordValue(HKCU, 'Software\Logtalk', 'Version', Version) then
    InstalledVersion := Version
  else if RegQueryDWordValue(HKLM, 'Software\Logtalk', 'Version', Version) then
    InstalledVersion := Version
  else if RegQueryStringValue(HKCU, 'Environment', 'LOGTALKHOME', LOGTALKHOME) and DirExists(LOGTALKHOME) then
    InstalledVersion := 0
  else if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'LOGTALKHOME', LOGTALKHOME) and DirExists(LOGTALKHOME) then
    InstalledVersion := 0
  else
    InstalledVersion := -1;
  if (InstalledVersion >= 0) and (InstalledVersion < 2440) then
  begin
    Warning := 'Your Logtalk user directory is outdated!'
               + Chr(13) + Chr(13)
               + 'You must updade your Logtalk user folder by performing a full installation.'
               + Chr(13) + Chr(13)
               + 'All aditional Logtalk users on your computer must also use this installer to update their Logtalk user folders.';
    WarningPage := CreateOutputMsgPage(wpWelcome, 'Warning', 'Logtalk user folder update required.', Warning)
  end;
  if NoBackEndPrologCompilerInstalled then
  begin
    Error := 'No compatible Prolog compiler found!'
             + Chr(13) + Chr(13)
             + 'Logtalk requires a compatible Prolog compiler to be installed in order to run. Logtalk uses a Prolog compiler as a back-end compiler.'
             + Chr(13) + Chr(13)
             + 'You must rerun the Logtalk installer after installing a compatible Prolog compiler.';
    ErrorPage := CreateOutputMsgPage(wpSelectDir, 'Warning', 'No compatible Prolog compiler found!', Error)
  end
end;


Install update

Install update

[Setup]
AppName=ATKSideChainCompressor
AppVersion=2.0.0
DefaultDirName={pf}\ATKSideChainCompressor
DefaultGroupName=ATKSideChainCompressor
Compression=lzma2
SolidCompression=yes
OutputDir=.\
ArchitecturesInstallIn64BitMode=x64
OutputBaseFilename=ATKSideChainCompressor Installer
LicenseFile=license.rtf
SetupLogging=yes

[Types]
Name: "full"; Description: "Full installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
;Name: "app"; Description: "Standalone application (.exe)"; Types: full custom;
Name: "vst2_32"; Description: "32-bit VST2 Plugin (.dll)"; Types: full custom;
Name: "vst2_64"; Description: "64-bit VST2 Plugin (.dll)"; Types: full custom; Check: Is64BitInstallMode;
Name: "vst3_32"; Description: "32-bit VST3 Plugin (.vst3)"; Types: full custom;
Name: "vst3_64"; Description: "64-bit VST3 Plugin (.vst3)"; Types: full custom; Check: Is64BitInstallMode;
;Name: "rtas_32"; Description: "32-bit RTAS Plugin (.dpm)"; Types: full custom;
;Name: "aax_32"; Description: "32-bit AAX Plugin (.aaxplugin)"; Types: full custom;
;Name: "aax_64"; Description: "64-bit AAX Plugin (.aaxplugin)"; Types: full custom; Check: Is64BitInstallMode;

[Files]
;Source: "..\build-win\app\Win32\bin\ATKSideChainCompressor.exe"; DestDir: "{app}"; Check: not Is64BitInstallMode; Components:app; Flags: ignoreversion;
;Source: "..\build-win\app\x64\bin\ATKSideChainCompressor.exe"; DestDir: "{app}"; Check: Is64BitInstallMode; Components:app; Flags: ignoreversion;

Source: "..\build-win\vst2\Win32\bin\ATKSideChainCompressor.dll"; DestDir: {code:GetVST2Dir_32}; Check: not Is64BitInstallMode; Components:vst2_32; Flags: ignoreversion;
Source: "..\build-win\vst2\Win32\bin\ATKSideChainCompressor.dll"; DestDir: {code:GetVST2Dir_32}; Check: Is64BitInstallMode; Components:vst2_32; Flags: ignoreversion;
Source: "..\build-win\vst2\x64\bin\ATKSideChainCompressor x64.dll"; DestDir: {code:GetVST2Dir_64}; Check: Is64BitInstallMode; Components:vst2_64; Flags: ignoreversion;

Source: "..\build-win\vst3\Win32\bin\ATKSideChainCompressor.vst3"; DestDir: "{cf}\VST3\"; Check: not Is64BitInstallMode; Components:vst3_32; Flags: ignoreversion;
Source: "..\build-win\vst3\Win32\bin\ATKSideChainCompressor.vst3"; DestDir: "{cf32}\VST3\"; Check: Is64BitInstallMode; Components:vst3_32; Flags: ignoreversion;
Source: "..\build-win\vst3\x64\bin\ATKSideChainCompressor x64.vst3"; DestDir: "{cf64}\VST3\"; Check: Is64BitInstallMode; Components:vst3_64; Flags: ignoreversion;

;Source: "..\build-win\rtas\bin\ATKSideChainCompressor.dpm"; DestDir: "{cf32}\Digidesign\DAE\Plug-Ins\"; Components:rtas_32; Flags: ignoreversion;
;Source: "..\build-win\rtas\bin\ATKSideChainCompressor.dpm.rsr"; DestDir: "{cf32}\Digidesign\DAE\Plug-Ins\"; Components:rtas_32; Flags: ignoreversion;

;Source: "..\build-win\aax\bin\ATKSideChainCompressor.aaxplugin\*.*"; DestDir: "{cf32}\Avid\Audio\Plug-Ins\ATKSideChainCompressor.aaxplugin\"; Components:aax_32; Flags: ignoreversion recursesubdirs;
;Source: "..\build-win\aax\bin\ATKSideChainCompressor.aaxplugin\*.*"; DestDir: "{cf}\Avid\Audio\Plug-Ins\ATKSideChainCompressor.aaxplugin\"; Components:aax_64; Flags: ignoreversion recursesubdirs;

Source: "..\manual\ATKSideChainCompressor_manual.pdf"; DestDir: "{app}"
Source: "changelog.txt"; DestDir: "{app}"
Source: "readmewin.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme
Source: "license.rtf"; DestDir: "{app}"; DestName: "license.rtf"

[Icons]
Name: "{group}\ATKSideChainCompressor"; Filename: "{app}\ATKSideChainCompressor.exe"
Name: "{group}\Changelog"; Filename: "{app}\changelog.txt"
;Name: "{group}\readme"; Filename: "{app}\readme.rtf"
Name: "{group}\Uninstall ATKSideChainCompressor"; Filename: "{app}\unins000.exe"

;[Dirs]
;Name: {cf}\Digidesign\DAE\Plugins\

[Code]
var
  OkToCopyLog : Boolean;
  VST2DirPage_32: TInputDirWizardPage;
  VST2DirPage_64: TInputDirWizardPage;

procedure InitializeWizard;
begin
  if IsWin64 then begin
    VST2DirPage_64 := CreateInputDirPage(wpSelectDir,
    'Confirm 64-Bit VST2 Plugin Directory', '',
    'Select the folder in which setup should install the 64-bit VST2 Plugin, then click Next.',
    False, '');
    VST2DirPage_64.Add('');
    VST2DirPage_64.Values[0] := ExpandConstant('{reg:HKLM\SOFTWARE\VST,VSTPluginsPath|{pf}\Steinberg\VSTPlugins}\');

    VST2DirPage_32 := CreateInputDirPage(wpSelectDir,
      'Confirm 32-Bit VST2 Plugin Directory', '',
      'Select the folder in which setup should install the 32-bit VST2 Plugin, then click Next.',
      False, '');
    VST2DirPage_32.Add('');
    VST2DirPage_32.Values[0] := ExpandConstant('{reg:HKLM\SOFTWARE\WOW6432NODE\VST,VSTPluginsPath|{pf32}\Steinberg\VSTPlugins}\');
  end else begin
    VST2DirPage_32 := CreateInputDirPage(wpSelectDir,
      'Confirm 32-Bit VST2 Plugin Directory', '',
      'Select the folder in which setup should install the 32-bit VST2 Plugin, then click Next.',
      False, '');
    VST2DirPage_32.Add('');
    VST2DirPage_32.Values[0] := ExpandConstant('{reg:HKLM\SOFTWARE\VST,VSTPluginsPath|{pf}\Steinberg\VSTPlugins}\');
  end;
end;

function GetVST2Dir_32(Param: String): String;
begin
  Result := VST2DirPage_32.Values[0]
end;

function GetVST2Dir_64(Param: String): String;
begin
  Result := VST2DirPage_64.Values[0]
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssDone then
    OkToCopyLog := True;
end;

procedure DeinitializeSetup();
begin
  if OkToCopyLog then
    FileCopy (ExpandConstant ('{log}'), ExpandConstant ('{app}\InstallationLogFile.log'), FALSE);
  RestartReplace (ExpandConstant ('{log}'), '');
end;

[UninstallDelete]
Type: files; Name: "{app}\InstallationLogFile.log"

[Setup]
AppName=ATKSideChainCompressor
AppVersion=1.0.0
DefaultDirName={pf}\ATKSideChainCompressor
DefaultGroupName=ATKSideChainCompressor
Compression=lzma2
SolidCompression=yes
OutputDir=.\
ArchitecturesInstallIn64BitMode=x64
OutputBaseFilename=ATKSideChainCompressor Installer
LicenseFile=license.rtf
SetupLogging=yes

[Types]
Name: "full"; Description: "Full installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
;Name: "app"; Description: "Standalone application (.exe)"; Types: full custom;
Name: "vst2_32"; Description: "32-bit VST2 Plugin (.dll)"; Types: full custom;
Name: "vst2_64"; Description: "64-bit VST2 Plugin (.dll)"; Types: full custom; Check: Is64BitInstallMode;
Name: "vst3_32"; Description: "32-bit VST3 Plugin (.vst3)"; Types: full custom;
Name: "vst3_64"; Description: "64-bit VST3 Plugin (.vst3)"; Types: full custom; Check: Is64BitInstallMode;
;Name: "rtas_32"; Description: "32-bit RTAS Plugin (.dpm)"; Types: full custom;
;Name: "aax_32"; Description: "32-bit AAX Plugin (.aaxplugin)"; Types: full custom;
;Name: "aax_64"; Description: "64-bit AAX Plugin (.aaxplugin)"; Types: full custom; Check: Is64BitInstallMode;

[Files]
;Source: "..\build-win\app\Win32\bin\ATKSideChainCompressor.exe"; DestDir: "{app}"; Check: not Is64BitInstallMode; Components:app; Flags: ignoreversion;
;Source: "..\build-win\app\x64\bin\ATKSideChainCompressor.exe"; DestDir: "{app}"; Check: Is64BitInstallMode; Components:app; Flags: ignoreversion;

Source: "..\build-win\vst2\Win32\bin\ATKSideChainCompressor.dll"; DestDir: {code:GetVST2Dir_32}; Check: not Is64BitInstallMode; Components:vst2_32; Flags: ignoreversion;
Source: "..\build-win\vst2\Win32\bin\ATKSideChainCompressor.dll"; DestDir: {code:GetVST2Dir_32}; Check: Is64BitInstallMode; Components:vst2_32; Flags: ignoreversion;
Source: "..\build-win\vst2\x64\bin\ATKSideChainCompressor x64.dll"; DestDir: {code:GetVST2Dir_64}; Check: Is64BitInstallMode; Components:vst2_64; Flags: ignoreversion;

Source: "..\build-win\vst3\Win32\bin\ATKSideChainCompressor.vst3"; DestDir: "{cf}\VST3\"; Check: not Is64BitInstallMode; Components:vst3_32; Flags: ignoreversion;
Source: "..\build-win\vst3\Win32\bin\ATKSideChainCompressor.vst3"; DestDir: "{cf32}\VST3\"; Check: Is64BitInstallMode; Components:vst3_32; Flags: ignoreversion;
Source: "..\build-win\vst3\x64\bin\ATKSideChainCompressor x64.vst3"; DestDir: "{cf64}\VST3\"; Check: Is64BitInstallMode; Components:vst3_64; Flags: ignoreversion;

;Source: "..\build-win\rtas\bin\ATKSideChainCompressor.dpm"; DestDir: "{cf32}\Digidesign\DAE\Plug-Ins\"; Components:rtas_32; Flags: ignoreversion;
;Source: "..\build-win\rtas\bin\ATKSideChainCompressor.dpm.rsr"; DestDir: "{cf32}\Digidesign\DAE\Plug-Ins\"; Components:rtas_32; Flags: ignoreversion;

;Source: "..\build-win\aax\bin\ATKSideChainCompressor.aaxplugin\*.*"; DestDir: "{cf32}\Avid\Audio\Plug-Ins\ATKSideChainCompressor.aaxplugin\"; Components:aax_32; Flags: ignoreversion recursesubdirs;
;Source: "..\build-win\aax\bin\ATKSideChainCompressor.aaxplugin\*.*"; DestDir: "{cf}\Avid\Audio\Plug-Ins\ATKSideChainCompressor.aaxplugin\"; Components:aax_64; Flags: ignoreversion recursesubdirs;

Source: "..\manual\ATKSideChainCompressor_manual.pdf"; DestDir: "{app}"
Source: "changelog.txt"; DestDir: "{app}"
Source: "readmewin.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme
Source: "license.rtf"; DestDir: "{app}"; DestName: "license.rtf"

[Icons]
Name: "{group}\ATKSideChainCompressor"; Filename: "{app}\ATKSideChainCompressor.exe"
Name: "{group}\Changelog"; Filename: "{app}\changelog.txt"
;Name: "{group}\readme"; Filename: "{app}\readme.rtf"
Name: "{group}\Uninstall ATKSideChainCompressor"; Filename: "{app}\unins000.exe"

;[Dirs]
;Name: {cf}\Digidesign\DAE\Plugins\

[Code]
var
  OkToCopyLog : Boolean;
  VST2DirPage_32: TInputDirWizardPage;
  VST2DirPage_64: TInputDirWizardPage;

procedure InitializeWizard;
begin
  if IsWin64 then begin
    VST2DirPage_64 := CreateInputDirPage(wpSelectDir,
    'Confirm 64-Bit VST2 Plugin Directory', '',
    'Select the folder in which setup should install the 64-bit VST2 Plugin, then click Next.',
    False, '');
    VST2DirPage_64.Add('');
    VST2DirPage_64.Values[0] := ExpandConstant('{reg:HKLM\SOFTWARE\VST,VSTPluginsPath|{pf}\Steinberg\VSTPlugins}\');

    VST2DirPage_32 := CreateInputDirPage(wpSelectDir,
      'Confirm 32-Bit VST2 Plugin Directory', '',
      'Select the folder in which setup should install the 32-bit VST2 Plugin, then click Next.',
      False, '');
    VST2DirPage_32.Add('');
    VST2DirPage_32.Values[0] := ExpandConstant('{reg:HKLM\SOFTWARE\WOW6432NODE\VST,VSTPluginsPath|{pf32}\Steinberg\VSTPlugins}\');
  end else begin
    VST2DirPage_32 := CreateInputDirPage(wpSelectDir,
      'Confirm 32-Bit VST2 Plugin Directory', '',
      'Select the folder in which setup should install the 32-bit VST2 Plugin, then click Next.',
      False, '');
    VST2DirPage_32.Add('');
    VST2DirPage_32.Values[0] := ExpandConstant('{reg:HKLM\SOFTWARE\VST,VSTPluginsPath|{pf}\Steinberg\VSTPlugins}\');
  end;
end;

function GetVST2Dir_32(Param: String): String;
begin
  Result := VST2DirPage_32.Values[0]
end;

function GetVST2Dir_64(Param: String): String;
begin
  Result := VST2DirPage_64.Values[0]
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssDone then
    OkToCopyLog := True;
end;

procedure DeinitializeSetup();
begin
  if OkToCopyLog then
    FileCopy (ExpandConstant ('{log}'), ExpandConstant ('{app}\InstallationLogFile.log'), FALSE);
  RestartReplace (ExpandConstant ('{log}'), '');
end;

[UninstallDelete]
Type: files; Name: "{app}\InstallationLogFile.log"


Setup Script version Bump,

Setup Script version Bump,

I always forget to commit the setup script.

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

#define MyAppName "TalkerMaker Deluxe"
#define MyAppVersion "2.1.4"
#define MyAppPublisher "Barky Seal Games"
#define MyAppURL "http://randallfitzgerald.net"
#define MyAppExeName "TalkerMakerDeluxe.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={{9DE1ACD9-F85C-4023-8475-E1D714BE868A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={localappdata}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\LICENSE
InfoBeforeFile=C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\CREDITS
OutputDir=C:\Users\randall\Desktop\Development\TalkerMakerDeluxeSetup
OutputBaseFilename=TalkerMakerDeluxe_Setup_x64
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.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: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TalkerMakerDeluxe.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\FontAwesome.WPF.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\GraphLayout.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\ICSharpCode.AvalonEdit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\layout.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TalkerMakerDeluxe.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TalkerMakerDeluxe.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TreeContainer.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.Toolkit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\recentfiles.config"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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 Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "TalkerMaker Deluxe"
#define MyAppVersion "2.1.3"
#define MyAppPublisher "Barky Seal Games"
#define MyAppURL "http://randallfitzgerald.net"
#define MyAppExeName "TalkerMakerDeluxe.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={{9DE1ACD9-F85C-4023-8475-E1D714BE868A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={localappdata}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\LICENSE
InfoBeforeFile=C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\CREDITS
OutputDir=C:\Users\randall\Desktop\Development\TalkerMakerDeluxeSetup
OutputBaseFilename=TalkerMakerDeluxe_Setup_x64
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.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: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TalkerMakerDeluxe.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\FontAwesome.WPF.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\GraphLayout.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\ICSharpCode.AvalonEdit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\layout.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TalkerMakerDeluxe.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TalkerMakerDeluxe.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\TreeContainer.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\Xceed.Wpf.Toolkit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\randall\Desktop\Development\TalkerMakerDeluxe\TalkerMakerDeluxe\bin\x64\Release\recentfiles.config"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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


fix install script for package ids

fix install script for package ids

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

#define MyAppName
#define MyAppVersion
#define MyAppPublisher
#define MyAppURL "http://fhir.org"

[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={{B39DF16F-6D54-4346-BB9E-3C6619BA11A2}
AppName=FHIR Notepad++ plugin
AppVersion=1.x
AppPublisher=Health Intersections
AppPublisherURL=http://healthintersections.com.au
AppSupportURL=http://wiki.hl7.org/index.php?title=FHIR_Notepad%2B%2B_Plugin_Documentation
AppUpdatesURL=http://healthintersections.com.au/FhirServer
DefaultDirName={pf}\Notepad++
DefaultGroupName=FHIR Applications
DisableProgramGroupPage=yes
LicenseFile=C:\work\fhirserver\install\npplicense.txt
InfoBeforeFile=C:\work\fhirserver\install\nppreadme.txt
OutputDir=C:\work\fhirserver\install\build
OutputBaseFilename=npp-install-1.0.40
SetupIconFile=C:\work\fhirserver\Server\fhir.ico
Compression=lzma
SolidCompression=yes
DirExistsWarning=no
DisableDirPage=no
AppVerName=FHIR Notepad++ Plugin 1.0.40

[Components]
Name: "n64"; Description: "64bit Notepad++"; Types: custom; Flags: exclusive
Name: "n32"; Description: "32bit Notepad++"; Types: custom; Flags: exclusive

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

[Files]
Source: "C:\work\fhirserver\exec\32\installer.dll";               Flags: dontcopy;

; 1st, the plug-in itself
Source: "C:\work\fhirserver\Exec\32\fhirnpp.dll";               DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\libeay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\ssleay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\64\fhirnpp.dll";               DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\libeay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\ssleay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\Program Files\Notepad++\allowAppDataPlugins.xml";   DestDir: "{app}";                  Flags: ignoreversion

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"; ValueType: dword; ValueName: "notepad++.exe"; ValueData: "10000"; Flags: createvalueifdoesntexist

[Code]
var
  LoadInstallPage : TOutputProgressWizardPage;

type
  TMyCallback = procedure(IntParam: Integer; StrParam: WideString);

Function MyDllDownloadPackages(mode : PAnsiChar; urls : PAnsiChar; callback: TMyCallback) : PAnsiChar; external 'MyDllDownloadPackages@files:installer.dll stdcall setuponly';

procedure InitCallback(IntParam: Integer; StrParam: WideString);
begin
  LoadInstallPage.SetProgress(intparam, 100);
  LoadInstallPage.SetText(StrParam, '');
end;

procedure InstallPackages;
var
  done : boolean;
  s : String;
  msg : String;
begin
  LoadInstallPage.SetText('Installing R3/R4/CDA Packages...', '');
  LoadInstallPage.SetProgress(0, 100);
  LoadInstallPage.Show;
  try
    s := ',hl7.fhir.r3.core#3.0.2,hl7.fhir.r4.core#4.0.1,hl7.fhir.r2.core#1.0.2';
    repeat
      done := true;
      msg := MyDllDownloadPackages('user', s, @InitCallback);
      if msg <> '' then
        done := MsgBox('Downloading the packages failed : '+msg+#13#10+'Try again? (can be done later through installed applications)', mbError, MB_YESNO) = mrNo;
    until done;
  finally
    LoadInstallPage.Hide;
  end;

end;

Procedure CreatePostInstallPage;
Begin
  LoadInstallPage := CreateOutputProgressPage('Perform Installation tasks', '');
End;

procedure InitializeWizard();
Begin
  CreatePostInstallPage;
End;

procedure CurStepChanged(CurStep: TSetupStep);
Begin
  if (CurStep = ssPostInstall)  Then
    InstallPackages;
End;

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

#define MyAppName
#define MyAppVersion
#define MyAppPublisher
#define MyAppURL "http://fhir.org"

[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={{B39DF16F-6D54-4346-BB9E-3C6619BA11A2}
AppName=FHIR Notepad++ plugin
AppVersion=1.x
AppPublisher=Health Intersections
AppPublisherURL=http://healthintersections.com.au
AppSupportURL=http://wiki.hl7.org/index.php?title=FHIR_Notepad%2B%2B_Plugin_Documentation
AppUpdatesURL=http://healthintersections.com.au/FhirServer
DefaultDirName={pf}\Notepad++
DefaultGroupName=FHIR Applications
DisableProgramGroupPage=yes
LicenseFile=C:\work\fhirserver\install\npplicense.txt
InfoBeforeFile=C:\work\fhirserver\install\nppreadme.txt
OutputDir=C:\work\fhirserver\install\build
OutputBaseFilename=npp-install-1.0.40
SetupIconFile=C:\work\fhirserver\Server\fhir.ico
Compression=lzma
SolidCompression=yes
DirExistsWarning=no
DisableDirPage=no
AppVerName=FHIR Notepad++ Plugin 1.0.40

[Components]
Name: "n64"; Description: "64bit Notepad++"; Types: custom; Flags: exclusive
Name: "n32"; Description: "32bit Notepad++"; Types: custom; Flags: exclusive

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

[Files]
Source: "C:\work\fhirserver\exec\32\installer.dll";               Flags: dontcopy;

; 1st, the plug-in itself
Source: "C:\work\fhirserver\Exec\32\fhirnpp.dll";               DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\libeay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\ssleay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\64\fhirnpp.dll";               DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\libeay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\ssleay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\Program Files\Notepad++\allowAppDataPlugins.xml";   DestDir: "{app}";                  Flags: ignoreversion

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"; ValueType: dword; ValueName: "notepad++.exe"; ValueData: "10000"; Flags: createvalueifdoesntexist

[Code]
var
  LoadInstallPage : TOutputProgressWizardPage;

type
  TMyCallback = procedure(IntParam: Integer; StrParam: WideString);

Function MyDllDownloadPackages(mode : PAnsiChar; urls : PAnsiChar; callback: TMyCallback) : PAnsiChar; external 'MyDllDownloadPackages@files:installer.dll stdcall setuponly';

procedure InitCallback(IntParam: Integer; StrParam: WideString);
begin
  LoadInstallPage.SetProgress(intparam, 100);
  LoadInstallPage.SetText(StrParam, '');
end;

procedure InstallPackages;
var
  done : boolean;
  s : String;
  msg : String;
begin
  LoadInstallPage.SetText('Installing R3/R4/CDA Packages...', '');
  LoadInstallPage.SetProgress(0, 100);
  LoadInstallPage.Show;
  try
    s := ',hl7.fhir.core#3.0.2,hl7.fhir.core#4.0.1,hl7.fhir.core#1.0.2';
    repeat
      done := true;
      msg := MyDllDownloadPackages('user', s, @InitCallback);
      if msg <> '' then
        done := MsgBox('Downloading the packages failed : '+msg+#13#10+'Try again? (can be done later through installed applications)', mbError, MB_YESNO) = mrNo;
    until done;
  finally
    LoadInstallPage.Hide;
  end;

end;

Procedure CreatePostInstallPage;
Begin
  LoadInstallPage := CreateOutputProgressPage('Perform Installation tasks', '');
End;

procedure InitializeWizard();
Begin
  CreatePostInstallPage;
End;

procedure CurStepChanged(CurStep: TSetupStep);
Begin
  if (CurStep = ssPostInstall)  Then
    InstallPackages;
End;


innosetup works fine

innosetup works fine

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

[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={{DCEA27B3-F601-4340-93B3-63DA04613409}
AppName=Cloud-In-One
AppVersion=0.5
;AppVerName=Cloud-In-One 0.5
DefaultDirName={pf}\CLOUDINONE
DefaultGroupName=CLOUD_IN_ONE
OutputDir=C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\cloud-in-one.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\cio-crypt.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\trusted-certs.crt"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\config\*"; DestDir: "{app}\config"; Flags: ignoreversion recursesubdirs createallsubdirs  ; BeforeInstall: WriteAppPath
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\Cloud-In-One"; Filename: "{app}\cloud-in-one.exe"
Name: "{group}\{cm:UninstallProgram,Cloud-In-One}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Cloud-In-One"; Filename: "{app}\cloud-in-one.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\cloud-in-one.exe"; Description: "{cm:LaunchProgram,Cloud-In-One}"; Flags: nowait postinstall skipifsilent;

[Code]
var
  DataDirPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
  { Create the pages }

  DataDirPage := CreateInputDirPage(wpSelectDir,
    'Select Synchronization Directory', 'Where should your data be synced?',
    'Select the folder in which the Application should sync your files, then click Next.',
    False, '');
  DataDirPage.Add('');

  { Set default values, using settings that were stored last time if possible }

  DataDirPage.Values[0] := ExpandConstant('{userdocs}\CLOUD_IN_ONE');
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  S: String;
begin
  { Fill the 'Ready Memo' with the normal settings and the custom settings }
  S := 'Sync Folder: ' + DataDirPage.Values[0] + NewLine;

  Result := S;
end;

function GetDataDir(Param: String): String;
var
  S: String;
  S2: String;
begin
  { Return the selected DataDir }
  S := DataDirPage.Values[0];
  StringChangeEx(S, '\', '/', True);
  Result := S
end;

procedure WriteAppPath;
var
    FileData: String;
begin
    LoadStringFromFile(ExpandConstant('{app}\config\config.json'), FileData);
    StringChange(FileData, 'XXXXXMARKERXXXXX', GetDataDir(''));
    SaveStringToFile(ExpandConstant('{app}\config\config.json'), FileData, False);
end;

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

[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={{DCEA27B3-F601-4340-93B3-63DA04613409}
AppName=Cloud-In-One
AppVersion=0.5
;AppVerName=Cloud-In-One 0.5
DefaultDirName={pf}\CLOUDINONE
DefaultGroupName=CLOUD_IN_ONE
OutputDir=C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\cloud-in-one.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\cio-crypt.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\trusted-certs.crt"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Vctor\Dropbox\__Universidad\5o\Cloud-In-One\dist\config\*"; DestDir: "{app}\config"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\Cloud-In-One"; Filename: "{app}\cloud-in-one.exe"
Name: "{group}\{cm:UninstallProgram,Cloud-In-One}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Cloud-In-One"; Filename: "{app}\cloud-in-one.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\cloud-in-one.exe"; Description: "{cm:LaunchProgram,Cloud-In-One}"; Flags: nowait postinstall skipifsilent

[Code]
var
  UserPage: TInputQueryWizardPage;
  UsagePage: TInputOptionWizardPage;
  LightMsgPage: TOutputMsgWizardPage;
  KeyPage: TInputQueryWizardPage;
  ProgressPage: TOutputProgressWizardPage;
  DataDirPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
  { Create the pages }

  UserPage := CreateInputQueryPage(wpWelcome,
    'Personal Information', 'Who are you?',
    'Please specify your name and the company for whom you work, then click Next.');
  UserPage.Add('Name:', False);
  UserPage.Add('Company:', False);

  UsagePage := CreateInputOptionPage(UserPage.ID,
    'Personal Information', 'How will you use My Program?',
    'Please specify how you would like to use My Program, then click Next.',
    True, False);
  UsagePage.Add('Light mode (no ads, limited functionality)');
  UsagePage.Add('Sponsored mode (with ads, full functionality)');
  UsagePage.Add('Paid mode (no ads, full functionality)');

  LightMsgPage := CreateOutputMsgPage(UsagePage.ID,
    'Personal Information', 'How will you use My Program?',
    'Note: to enjoy all features My Program can offer and to support its development, ' +
    'you can switch to sponsored or paid mode at any time by selecting ''Usage Mode'' ' +
    'in the ''Help'' menu of My Program after the installation has completed.'#13#13 +
    'Click Back if you want to change your usage mode setting now, or click Next to ' +
    'continue with the installation.');

  KeyPage := CreateInputQueryPage(UsagePage.ID,
    'Personal Information', 'What''s your registration key?',
    'Please specify your registration key and click Next to continue. If you don''t ' +
    'have a valid registration key, click Back to choose a different usage mode.');
  KeyPage.Add('Registration key:', False);

  ProgressPage := CreateOutputProgressPage('Personal Information',
    'What''s your registration key?');

  DataDirPage := CreateInputDirPage(wpSelectDir,
    'Select Personal Data Directory', 'Where should personal data files be installed?',
    'Select the folder in which Setup should install personal data files, then click Next.',
    False, '');
  DataDirPage.Add('');

  { Set default values, using settings that were stored last time if possible }

  UserPage.Values[0] := GetPreviousData('Name', ExpandConstant('{sysuserinfoname}'));
  UserPage.Values[1] := GetPreviousData('Company', ExpandConstant('{sysuserinfoorg}'));

  case GetPreviousData('UsageMode', '') of
    'light': UsagePage.SelectedValueIndex := 0;
    'sponsored': UsagePage.SelectedValueIndex := 1;
    'paid': UsagePage.SelectedValueIndex := 2;
  else
    UsagePage.SelectedValueIndex := 1;
  end;

  DataDirPage.Values[0] := GetPreviousData('DataDir', '');
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
var
  UsageMode: String;
begin
  { Store the settings so we can restore them next time }
  SetPreviousData(PreviousDataKey, 'Name', UserPage.Values[0]);
  SetPreviousData(PreviousDataKey, 'Company', UserPage.Values[1]);
  case UsagePage.SelectedValueIndex of
    0: UsageMode := 'light';
    1: UsageMode := 'sponsored';
    2: UsageMode := 'paid';
  end;
  SetPreviousData(PreviousDataKey, 'UsageMode', UsageMode);
  SetPreviousData(PreviousDataKey, 'DataDir', DataDirPage.Values[0]);
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  { Skip pages that shouldn't be shown }
  if (PageID = LightMsgPage.ID) and (UsagePage.SelectedValueIndex <> 0) then
    Result := True
  else if (PageID = KeyPage.ID) and (UsagePage.SelectedValueIndex <> 2) then
    Result := True
  else
    Result := False;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  I: Integer;
begin
  { Validate certain pages before allowing the user to proceed }
  if CurPageID = UserPage.ID then begin
    if UserPage.Values[0] = '' then begin
      MsgBox('You must enter your name.', mbError, MB_OK);
      Result := False;
    end else begin
      if DataDirPage.Values[0] = '' then
        DataDirPage.Values[0] := 'C:\' + UserPage.Values[0];
      Result := True;
    end;
  end else if CurPageID = KeyPage.ID then begin
    { Just to show how 'OutputProgress' pages work.
      Always use a try..finally between the Show and Hide calls as shown below. }
    ProgressPage.SetText('Authorizing registration key...', '');
    ProgressPage.SetProgress(0, 0);
    ProgressPage.Show;
    try
      for I := 0 to 10 do begin
        ProgressPage.SetProgress(I, 10);
        Sleep(100);
      end;
    finally
      ProgressPage.Hide;
    end;
    if GetSHA1OfString('codedlg' + KeyPage.Values[0]) = '8013f310d340dab18a0d0cda2b5b115d2dcd97e4' then
      Result := True
    else begin
      MsgBox('You must enter a valid registration key. (Hint: The key is "inno".)', mbError, MB_OK);
      Result := False;
    end;
  end else
    Result := True;
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  S: String;
begin
  { Fill the 'Ready Memo' with the normal settings and the custom settings }
  S := '';
  S := S + 'Personal Information:' + NewLine;
  S := S + Space + UserPage.Values[0] + NewLine;
  if UserPage.Values[1] <> '' then
    S := S + Space + UserPage.Values[1] + NewLine;
  S := S + NewLine;

  S := S + 'Usage Mode:' + NewLine + Space;
  case UsagePage.SelectedValueIndex of
    0: S := S + 'Light mode';
    1: S := S + 'Sponsored mode';
    2: S := S + 'Paid mode';
  end;
  S := S + NewLine + NewLine;

  S := S + MemoDirInfo + NewLine;
  S := S + Space + DataDirPage.Values[0] + ' (personal data files)' + NewLine;

  Result := S;
end;

function GetUser(Param: String): String;
begin
  { Return a user value }
  { Could also be split into separate GetUserName and GetUserCompany functions }
  if Param = 'Name' then
    Result := UserPage.Values[0]
  else if Param = 'Company' then
    Result := UserPage.Values[1];
end;

function GetDataDir(Param: String): String;
begin
  { Return the selected DataDir }
  Result := DataDirPage.Values[0];
end;