Fixed the icon for the shortcut.

Fixed the icon for the shortcut.

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

#define MyAppName "Lazymine"
#define MyAppVersion "v 2.0.1"
#define MyAppPublisher "Lazymine.github.io"
#define MyAppURL "http://lazymine.github.io/"
#define MyAppExeName "nw.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={{DC362068-58EE-4BD9-885D-0EB1B0C64696}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=..\..\LICENSE
OutputBaseFilename=Lazymine
SetupIconFile=..\..\lazymine.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin

[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: "..\..\lazymine.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\node_modules\nw\nwjs\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\lazymine.ico"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\lazymine.ico"
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

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

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

#define MyAppName "Lazymine"
#define MyAppVersion "V 2.0.1"
#define MyAppPublisher "Lazymine.github.io"
#define MyAppURL "http://lazymine.github.io/"
#define MyAppExeName "nw.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={{DC362068-58EE-4BD9-885D-0EB1B0C64696}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=..\..\LICENSE
OutputBaseFilename=Lazymine
SetupIconFile=..\..\lazymine.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin

[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: "..\..\node_modules\nw\nwjs\Lazymine.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\node_modules\nw\nwjs\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

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


Update runtimes

Update runtimes

// requires Windows 10, Windows 7 Service Pack 1, Windows 8, Windows 8.1, Windows Server 2003 Service Pack 2, Windows Server 2008 R2 SP1, Windows Server 2008 Service Pack 2, Windows Server 2012, Windows Vista Service Pack 2, Windows XP Service Pack 3
// http://www.microsoft.com/en-US/download/details.aspx?id=48145

[CustomMessages]
vcredist2015_title=Visual C++ 2015 Update 3 Redistributable
vcredist2015_title_x64=Visual C++ 2015 Update 3 64-Bit Redistributable

en.vcredist2015_size=13.8 MB

en.vcredist2015_size_x64=14.6 MB

[Code]
const
	vcredist2015_url = 'http://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x86.exe';
	vcredist2015_url_x64 = 'http://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe';

	vcredist2015_productcode = '{69BCE4AC-9572-3271-A2FB-9423BDA36A43}';
	vcredist2015_productcode_x64 = '{EF1EC6A9-17DE-3DA9-B040-686A1E8A8B04}';

procedure vcredist2015();
begin
	if (not IsIA64()) then begin
		if (not msiproduct(GetString(vcredist2015_productcode, vcredist2015_productcode_x64, ''))) then
			AddProduct('vcredist2015' + GetArchitectureString() + '.exe',
				'/passive /norestart',
				CustomMessage('vcredist2015_title' + GetArchitectureString()),
				CustomMessage('vcredist2015_size' + GetArchitectureString()),
				GetString(vcredist2015_url, vcredist2015_url_x64, ''),
				false, false);
	end;
end;

// requires Windows 10, Windows 7 Service Pack 1, Windows 8, Windows 8.1, Windows Server 2003 Service Pack 2, Windows Server 2008 R2 SP1, Windows Server 2008 Service Pack 2, Windows Server 2012, Windows Vista Service Pack 2, Windows XP Service Pack 3
// http://www.microsoft.com/en-US/download/details.aspx?id=48145

[CustomMessages]
vcredist2015_title=Visual C++ 2015 Update 3 Redistributable
vcredist2015_title_x64=Visual C++ 2015 Update 3 64-Bit Redistributable

en.vcredist2015_size=13.8 MB

en.vcredist2015_size_x64=14.6 MB

[Code]
const
	vcredist2015_url = 'http://download.microsoft.com/download/9/a/2/9a2a7e36-a8af-46c0-8a78-a5eb111eefe2/vc_redist.x86.exe';
	vcredist2015_url_x64 = 'http://download.microsoft.com/download/2/a/2/2a2ef9ab-1b4b-49f0-9131-d33f79544e70/vc_redist.x64.exe';

	vcredist2015_productcode = '{844ECB74-9B63-3D5C-958C-30BD23F19EE4}';
	vcredist2015_productcode_x64 = '{F20396E5-D84E-3505-A7A8-7358F0155F6C}';

procedure vcredist2015();
begin
	if (not IsIA64()) then begin
		if (not msiproduct(GetString(vcredist2015_productcode, vcredist2015_productcode_x64, ''))) then
			AddProduct('vcredist2015' + GetArchitectureString() + '.exe',
				'/passive /norestart',
				CustomMessage('vcredist2015_title' + GetArchitectureString()),
				CustomMessage('vcredist2015_size' + GetArchitectureString()),
				GetString(vcredist2015_url, vcredist2015_url_x64, ''),
				false, false);
	end;
end;


Bug 2975: Update Windows installation.

Bug 2975: Update Windows installation.

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

#define MyAppName "COPASI"
#define MyAppVersion "0.0.0"
#define MyAppPublisher "copasi.org"
#define MyAppURL "http://www.copasi.org/"
#define MyAppExeName "bin\CopasiUI.exe"
#define MyBuild "0"
#define MyAppId "{{00000000-0000-0000-0000-000000000000}"
#define MyWorkDir "C:\cygwin\home\shoops\environment\COPASI\InnoSetup"
#define MyStageDir "C:\cygwin\home\shoops\environment\setup\package"

[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={#MyAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesAssociations=true
ChangesEnvironment=true
DefaultDirName={code:DefDirRoot}\{#MyAppPublisher}\{#MyAppName} {#MyAppVersion}
DefaultGroupName={#MyAppName} {#MyAppVersion}
OutputDir={#MyWorkDir}
OutputBaseFilename=COPASI-{#MyAppVersion}-Windows
SetupIconFile={#MyWorkDir}\addremov.ico
Compression=lzma/Ultra
SolidCompression=true
InternalCompressLevel=Ultra
SignedUninstaller=false
VersionInfoVersion={#MyAppVersion}.0
ShowLanguageDialog=no
UninstallDisplayIcon={app}\share\copasi\icons\Copasi.ico
UninstallDisplayName={#MyAppName} {#MyAppVersion}
PrivilegesRequired=none
VersionInfoCompany=copasi.org
ArchitecturesAllowed=x86 x64
ArchitecturesInstallIn64BitMode=x64

[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]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
; 32 bit Executables and DLLs
Source: {#MyStageDir}\bin\32\CopasiSE.exe; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\CopasiUI.exe; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\qt.conf; DestDir: {app}\bin; Check: IsWin32();
; Source: {#MyStageDir}\bin\32\libmmd.dll; DestDir: {app}\bin; Check: IsWin32();
; Source: {#MyStageDir}\bin\32\svml_dispmd.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Core.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5DataVisualization.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Gui.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Network.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5OpenGL.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5PrintSupport.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Svg.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Widgets.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Xml.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\d3dcompiler_47.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\libEGL.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\libGLESV2.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\opengl32sw.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\libeay32.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\ssleay32.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\bearer\qgenericbearer.dll; DestDir: {app}\bin\bearer; Check: IsWin32();
Source: {#MyStageDir}\bin\32\iconengines\qsvgicon.dll; DestDir: {app}\bin\iconengines; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qgif.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qicns.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qico.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qjpeg.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qsvg.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qtga.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qtiff.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qwbmp.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qwebp.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\platforms\qwindows.dll; DestDir: {app}\bin\platforms; Check: IsWin32();
Source: {#MyStageDir}\bin\32\printsupport\windowsprintersupport.dll; DestDir: {app}\bin\printsupport; Check: IsWin32();
Source: {#MyStageDir}\bin\32\vcruntime140.dll; DestDir: {app}\bin; Check: InstallUserRuntime32();
Source: {#MyStageDir}\bin\32\msvcp140.dll; DestDir: {app}\bin; Check: InstallUserRuntime32();

; 64 bit Executables and DLLs
Source: {#MyStageDir}\bin\64\CopasiSE.exe; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\CopasiUI.exe; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\qt.conf; DestDir: {app}\bin; Check: IsWin64();
; Source: {#MyStageDir}\bin\64\libmmd.dll; DestDir: {app}\bin; Check: IsWin64();
; Source: {#MyStageDir}\bin\64\svml_dispmd.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Core.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5DataVisualization.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Gui.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Network.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5OpenGL.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5PrintSupport.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Svg.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Widgets.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Xml.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\d3dcompiler_47.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\libEGL.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\libGLESV2.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\opengl32sw.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\libeay32.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\ssleay32.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\bearer\qgenericbearer.dll; DestDir: {app}\bin\bearer; Check: IsWin64();
Source: {#MyStageDir}\bin\64\iconengines\qsvgicon.dll; DestDir: {app}\bin\iconengines; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qgif.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qicns.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qico.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qjpeg.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qsvg.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qtga.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qtiff.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qwbmp.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qwebp.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\platforms\qwindows.dll; DestDir: {app}\bin\platforms; Check: IsWin64();
Source: {#MyStageDir}\bin\64\printsupport\windowsprintersupport.dll; DestDir: {app}\bin\printsupport; Check: IsWin64();
Source: {#MyStageDir}\bin\64\vcruntime140.dll; DestDir: {app}\bin; Check: InstallUserRuntime64();
Source: {#MyStageDir}\bin\64\msvcp140.dll; DestDir: {app}\bin; Check: InstallUserRuntime64();

; Common Resources
Source: {#MyStageDir}\README.txt; DestDir: {app}
Source: {#MyStageDir}\LICENSE.txt; DestDir: {app}

; Tutorial Wizzard
Source: {#MyStageDir}\share\copasi\config\MIRIAMResources.xml; DestDir: {app}\share\copasi\config
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step6.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step1.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step2.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step3.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step4.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step5.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\figures\TimeCourseDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ModelSettingsDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\NewPlotAdded.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ObjectBrowserSelection.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ObjectBrowserTree.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\OutputAssistant.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\PlotCurveSelectionDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\PlotDefinition.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\PlotWindow.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReactionDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReactionOverview.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReactionOverviewEmpty.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReportDefinitionDialog.png; DestDir: {app}\share\copasi\doc\html\figures

; Icons
Source: {#MyStageDir}\share\copasi\icons\CopasiDoc.ico; DestDir: {app}\share\copasi\icons
Source: {#MyStageDir}\share\copasi\icons\Copasi.ico; DestDir: {app}\share\copasi\icons

; Examples
Source: {#MyStageDir}\share\copasi\examples\YeastGlycolysis.gps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\brusselator.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\CircadianClock.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\DimericMWC-stiff.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\Genetic-2000Elo.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\MAPK-HF96-layout.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\Metabolism-2000Poo.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\NF-kappaB.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\Olsen2003_peroxidase.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\brusselator.sedml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\brusselator-model.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\NF-kappaB.sedml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\NF-kappaB-model.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\scan.sedml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\oscli.xml; DestDir: {app}\share\copasi\examples

; VC Redistributable
Source: {#MyStageDir}\bin\32\vcredist_x86.exe; DestDir: {app}; Flags: deleteafterinstall; Check: IsWin32();
Source: {#MyStageDir}\bin\64\vcredist_x64.exe; DestDir: {app}; Flags: deleteafterinstall; Check: IsWin64();

[Icons]
Name: {group}\CopasiUI; Filename: {app}\{#MyAppExeName}; WorkingDir: {userdocs}
Name: {group}\{cm:ProgramOnTheWeb,{#MyAppName}}; Filename: {#MyAppURL}
Name: {group}\License; Filename: {app}\LICENSE.txt
Name: {group}\README; Filename: {app}\README.txt
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; WorkingDir: {userdocs}
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: quicklaunchicon; WorkingDir: {userdocs}

[Run]
Filename: {app}\vcredist_x86.exe; Parameters: /q /norestart; StatusMsg: Installing Microsoft Visual C++ 2017 32 bit Runtime Libraries; Check: InstallSystemRuntime32()
Filename: {app}\vcredist_x64.exe; Parameters: /q /norestart; StatusMsg: Installing Microsoft Visual C++ 2017 64 bit Runtime Libraries; Check: InstallSystemRuntime64()

[Dirs]
Name: {app}\bin
Name: {app}\bin\bearer
Name: {app}\bin\iconengines
Name: {app}\bin\imageformats
Name: {app}\bin\platforms
Name: {app}\bin\printsupport
Name: {app}\share
Name: {app}\share\copasi
Name: {app}\share\copasi\config
Name: {app}\share\copasi\doc
Name: {app}\share\copasi\doc\html
Name: {app}\share\copasi\doc\html\figures
Name: {app}\share\copasi\examples
Name: {app}\share\copasi\icons

[Registry]
Root: HKCR; SubKey: .cps; ValueType: string; ValueData: COPASI.document; Flags: uninsdeletekey; Check: IsAdminUser
Root: HKCR; SubKey: COPASI.document; ValueType: string; ValueData: COPASI File; Flags: uninsdeletekey; Check: IsAdminUser
Root: HKCR; SubKey: COPASI.document\Shell\Open\Command; ValueType: string; ValueData: """{app}\bin\CopasiUI.exe"" ""%1"""; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKCR; Subkey: COPASI.document\DefaultIcon; ValueType: string; ValueData: {app}\share\copasi\icons\CopasiDoc.ico,-1; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKCR; Subkey: COPASI; ValueType: string; ValueData: "URL: COPASI Protocol"; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKCR; Subkey: COPASI; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKCR; Subkey: COPASI\DefaultIcon; ValueType: string; ValueData: {app}\share\copasi\icons\CopasiDoc.ico,-1; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKCR; Subkey: COPASI\Shell\Open\Command; ValueType: string; ValueData: """{app}\bin\CopasiUI.exe"" ""%1"""; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: string; ValueName: COPASIDIR; ValueData: {app}; Check: IsAdminUser
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: expandsz; ValueName: Path; ValueData: "%COPASIDIR%\bin;{olddata}"; Check: UpdateSystemPath
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueType: string; ValueName: "{app}\bin\CopasiUI.exe"; ValueData: "~ WIN7RTM"; Flags: uninsdeletevalue; Check: IsAdminUserAndWindows8
Root: HKCU; SubKey: Software\Classes\.cps; ValueType: string; ValueData: COPASI.document; Flags: uninsdeletekey; Check: IsRegularUser
Root: HKCU; SubKey: Software\Classes\COPASI.document; ValueType: string; ValueData: COPASI File; Flags: uninsdeletekey; Check: IsRegularUser
Root: HKCU; SubKey: Software\Classes\COPASI.document\Shell\Open\Command; ValueType: string; ValueData: """{app}\bin\CopasiUI.exe"" ""%1"""; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Software\Classes\COPASI.document\DefaultIcon; ValueType: string; ValueData: {app}\share\copasi\icons\CopasiDoc.ico,-1; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Software\Classes\COPASI; ValueType: string; ValueData: "URL: COPASI Protocol"; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Software\Classes\COPASI; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Software\Classes\COPASI\DefaultIcon; ValueType: string; ValueData: {app}\share\copasi\icons\CopasiDoc.ico,-1; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Software\Classes\COPASI\Shell\Open\Command; ValueType: string; ValueData: """{app}\bin\CopasiUI.exe"" ""%1"""; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Environment; ValueType: string; ValueName: COPASIDIR; ValueData: {app}; Check: IsRegularUser
Root: HKCU; Subkey: Environment; ValueType: expandsz; ValueName: Path; ValueData: "%COPASIDIR%\bin;{olddata}"; Check: UpdateUserPath
Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueType: string; ValueName: "{app}\bin\CopasiUI.exe"; ValueData: "~ WIN7RTM"; Flags: uninsdeletevalue; Check: IsRegularUserAndWindows8

[Code]
type
  RunTimeVersion = array [0..3] of Integer;

function IsWin32(): Boolean;
begin
  Result := not IsWin64;
end;

function IsAdminUser(): Boolean;
begin
  Result := (IsAdminLoggedOn or IsPowerUserLoggedOn);
end;

function IsRegularUser(): Boolean;
begin
  Result := not (IsAdminLoggedOn or IsPowerUserLoggedOn);
end;

function isWindows8(): Boolean;
var
  Version: TWindowsVersion;

begin
  GetWindowsVersionEx(Version);

  Result := ((Version.Major = 6) and (Version.Minor = 2));
end;

function IsAdminUserAndWindows8(): Boolean;
begin
  Result := (IsAdminUser() and isWindows8());
end;

function IsRegularUserAndWindows8(): Boolean;
begin
  Result := (IsRegularUser() and isWindows8());
end;

function IsCopasiInSystemPath(): Boolean;
var
  CurrentPath: String;
  Position: Integer;

begin
  Result := False;

  if RegQueryStringValue(HKLM,
    'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
    'Path', CurrentPath) then
    // Successfully read the value
    begin
      Position := Pos('%COPASIDIR%\bin', CurrentPath);
      if (Position <> 0) then
        // Found an entry to the COPASI binaries in the Path
        begin
          Result := True;
        end;
    end;
end;

function IsCopasiInUserPath(): Boolean;
var
  CurrentPath: String;
  Position: Integer;

begin
  Result := IsCopasiInSystemPath();

  if RegQueryStringValue(HKCU,
    'Environment',
    'Path', CurrentPath) then
    // Successfully read the value
    begin
      Position := Pos('%COPASIDIR%\bin', CurrentPath);
      if (Position <> 0) then
        // Found an entry to the COPASI binaries in the Path
        begin
          Result := True;
        end;
    end;
end;

function UpdateSystemPath(): Boolean;
begin
  Result := (IsAdminUser() and not IsCopasiInSystemPath());
end;

function UpdateUserPath(): Boolean;
begin
  Result := (IsRegularUser() and not IsCopasiInUserPath());
end;

function StrToVersion(str: String): RunTimeVersion;
var
  Version: RunTimeVersion;
  Position: Integer;

begin
  try
    begin
      Position := Pos('.', str);
      Version[0] := StrToInt(Copy(str, 1, Position - 1));
      Delete(str, 1, Position);

      Position := Pos('.', str);
      Version[1] := StrToInt(Copy(str, 1, Position - 1));
      Delete(str, 1, Position);

      Position := Pos('.', str);
      Version[2] := StrToInt(Copy(str, 1, Position - 1));
      Delete(str, 1, Position);

      Version[3] := StrToInt(str);
    end;

  except
    begin
      Version[0] := 0;
      Version[1] := 0;
      Version[2] := 0;
      Version[3] := 0;
    end;
  end;

  Result := Version;
end;

function VersionToStr(Version: RunTimeVersion): String;
begin
  Result := IntToStr(Version[0]) + '.' +
            IntToStr(Version[1]) + '.' +
            IntToStr(Version[2]) + '.' +
            IntToStr(Version[3]);
end;

function CompareVersion(Version1: RunTimeVersion;
                        Version2: RunTimeVersion): Integer;
begin
  if Version1[0] <> Version2[0] then
    Result := Version1[0] - Version2[0]
  else if Version1[1] <> Version2[1] then
    Result := Version1[1] - Version2[1]
  else if Version1[2] <> Version2[2] then
    Result := Version1[2] - Version2[2]
  else
    Result := Version1[3] - Version2[3];
end;

function IsInVersionRange(OldVersionRange: String;
                          Version: RunTimeVersion): Boolean;
var
  LowerBound: RunTimeVersion;
  UpperBound: RunTimeVersion;
  Position: Integer;

begin
  Result := False;
  Position := Pos('-', OldVersionRange);

  if Position <> 0 then
    begin
      LowerBound := StrToVersion(Copy(OldVersionRange, 1, Position - 1));
      UpperBound := StrToVersion(Copy(OldVersionRange, Position + 1, 100));
    end
  else
    begin
      LowerBound := StrToVersion(OldVersionRange);
      UpperBound := LowerBound;
    end;

  if (CompareVersion(LowerBound, Version) <= 0) and
     (CompareVersion(Version, UpperBound) <= 0) then
    begin
      Result := True;
    end;
end;

function HaveRuntime64(): Boolean;
begin
  Result := RegKeyExists(HKEY_CLASSES_ROOT, 'Installer\\Products\\083F30FCC2E18753C8E02308E78B0C8D') or
            RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2CD849A7-86A1-34A6-B8F9-D72F5B21A9AE}');
end;

function HaveRuntime32(): Boolean;
begin
  Result := RegKeyExists(HKEY_CLASSES_ROOT, 'Installer\\Products\\1A57DEF7C006B493386717E2A288162F') or
            RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{56e11d69-7cc9-40a5-a4f9-8f6190c4d84d}')
end;

function InstallSystemRuntime32(): Boolean;
begin
  Result := IsWin32() and IsAdminUser() and not HaveRunTime32();
end;

function InstallSystemRuntime64(): Boolean;
begin
  Result := IsWin64() and IsAdminUser() and not HaveRunTime64();
end;

function InstallUserRuntime32(): Boolean;
begin
  Result := IsWin32() and IsRegularUser() and not HaveRunTime32();
end;

function InstallUserRuntime64(): Boolean;
begin
  Result := IsWin64() and IsRegularUser() and not HaveRunTime64();
end;

function InitializeSetup(): Boolean;
begin
  Result := True;

  RegDeleteValue(HKEY_CURRENT_USER, 'Environment', 'COPASIDIR');
end;

function DefDirRoot(Param: String): String;
begin
  if IsRegularUser() then
    Result := ExpandConstant('{localappdata}')
  else if IsWin64() then
    Result := ExpandConstant('{pf64}')
  else
    Result := ExpandConstant('{pf}');
end;

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

#define MyAppName "COPASI"
#define MyAppVersion "0.0.0"
#define MyAppPublisher "copasi.org"
#define MyAppURL "http://www.copasi.org/"
#define MyAppExeName "bin\CopasiUI.exe"
#define MyBuild "0"
#define MyAppId "{{00000000-0000-0000-0000-000000000000}"
#define MyWorkDir "C:\cygwin\home\shoops\environment\COPASI\InnoSetup"
#define MyStageDir "C:\cygwin\home\shoops\environment\setup\package"

[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={#MyAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesAssociations=true
ChangesEnvironment=true
DefaultDirName={code:DefDirRoot}\{#MyAppPublisher}\{#MyAppName} {#MyAppVersion}
DefaultGroupName={#MyAppName} {#MyAppVersion}
OutputDir={#MyWorkDir}
OutputBaseFilename=COPASI-{#MyAppVersion}-Windows
SetupIconFile={#MyWorkDir}\addremov.ico
Compression=lzma/Ultra
SolidCompression=true
InternalCompressLevel=Ultra
SignedUninstaller=false
VersionInfoVersion={#MyAppVersion}.0
ShowLanguageDialog=no
UninstallDisplayIcon={app}\share\copasi\icons\Copasi.ico
UninstallDisplayName={#MyAppName} {#MyAppVersion}
PrivilegesRequired=none
VersionInfoCompany=copasi.org
ArchitecturesAllowed=x86 x64
ArchitecturesInstallIn64BitMode=x64

[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]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
; 32 bit Executables and DLLs
Source: {#MyStageDir}\bin\32\CopasiSE.exe; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\CopasiUI.exe; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\qt.conf; DestDir: {app}\bin; Check: IsWin32();
; Source: {#MyStageDir}\bin\32\libmmd.dll; DestDir: {app}\bin; Check: IsWin32();
; Source: {#MyStageDir}\bin\32\svml_dispmd.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Core.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5DataVisualization.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Gui.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Network.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5OpenGL.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5PrintSupport.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Svg.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Widgets.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\Qt5Xml.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\d3dcompiler_47.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\libEGL.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\libGLESV2.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\opengl32sw.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\libeay32.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\ssleay32.dll; DestDir: {app}\bin; Check: IsWin32();
Source: {#MyStageDir}\bin\32\bearer\qgenericbearer.dll; DestDir: {app}\bin\bearer; Check: IsWin32();
Source: {#MyStageDir}\bin\32\iconengines\qsvgicon.dll; DestDir: {app}\bin\iconengines; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qgif.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qicns.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qico.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qjpeg.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qsvg.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qtga.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qtiff.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qwbmp.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\imageformats\qwebp.dll; DestDir: {app}\bin\imageformats; Check: IsWin32();
Source: {#MyStageDir}\bin\32\platforms\qwindows.dll; DestDir: {app}\bin\platforms; Check: IsWin32();
Source: {#MyStageDir}\bin\32\printsupport\windowsprintersupport.dll; DestDir: {app}\bin\printsupport; Check: IsWin32();
Source: {#MyStageDir}\bin\32\vcruntime140.dll; DestDir: {app}\bin; Check: InstallUserRuntime32();
Source: {#MyStageDir}\bin\32\msvcp140.dll; DestDir: {app}\bin; Check: InstallUserRuntime32();

; 64 bit Executables and DLLs
Source: {#MyStageDir}\bin\64\CopasiSE.exe; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\CopasiUI.exe; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\qt.conf; DestDir: {app}\bin; Check: IsWin64();
; Source: {#MyStageDir}\bin\64\libmmd.dll; DestDir: {app}\bin; Check: IsWin64();
; Source: {#MyStageDir}\bin\64\svml_dispmd.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Core.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5DataVisualization.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Gui.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Network.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5OpenGL.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5PrintSupport.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Svg.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Widgets.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\Qt5Xml.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\d3dcompiler_47.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\libEGL.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\libGLESV2.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\opengl32sw.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\libeay32.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\ssleay32.dll; DestDir: {app}\bin; Check: IsWin64();
Source: {#MyStageDir}\bin\64\bearer\qgenericbearer.dll; DestDir: {app}\bin\bearer; Check: IsWin64();
Source: {#MyStageDir}\bin\64\iconengines\qsvgicon.dll; DestDir: {app}\bin\iconengines; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qgif.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qicns.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qico.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qjpeg.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qsvg.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qtga.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qtiff.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qwbmp.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\imageformats\qwebp.dll; DestDir: {app}\bin\imageformats; Check: IsWin64();
Source: {#MyStageDir}\bin\64\platforms\qwindows.dll; DestDir: {app}\bin\platforms; Check: IsWin64();
Source: {#MyStageDir}\bin\64\printsupport\windowsprintersupport.dll; DestDir: {app}\bin\printsupport; Check: IsWin64();
Source: {#MyStageDir}\bin\64\vcruntime140.dll; DestDir: {app}\bin; Check: InstallUserRuntime64();
Source: {#MyStageDir}\bin\64\msvcp140.dll; DestDir: {app}\bin; Check: InstallUserRuntime64();

; Common Resources
Source: {#MyStageDir}\README.txt; DestDir: {app}
Source: {#MyStageDir}\LICENSE.txt; DestDir: {app}

; Tutorial Wizzard
Source: {#MyStageDir}\share\copasi\config\MIRIAMResources.xml; DestDir: {app}\share\copasi\config
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step6.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step1.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step2.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step3.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step4.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\TutWiz-Step5.html; DestDir: {app}\share\copasi\doc\html
Source: {#MyStageDir}\share\copasi\doc\html\figures\TimeCourseDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ModelSettingsDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\NewPlotAdded.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ObjectBrowserSelection.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ObjectBrowserTree.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\OutputAssistant.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\PlotCurveSelectionDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\PlotDefinition.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\PlotWindow.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReactionDialog.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReactionOverview.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReactionOverviewEmpty.png; DestDir: {app}\share\copasi\doc\html\figures
Source: {#MyStageDir}\share\copasi\doc\html\figures\ReportDefinitionDialog.png; DestDir: {app}\share\copasi\doc\html\figures

; Icons
Source: {#MyStageDir}\share\copasi\icons\CopasiDoc.ico; DestDir: {app}\share\copasi\icons
Source: {#MyStageDir}\share\copasi\icons\Copasi.ico; DestDir: {app}\share\copasi\icons

; Examples
Source: {#MyStageDir}\share\copasi\examples\YeastGlycolysis.gps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\brusselator.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\CircadianClock.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\DimericMWC-stiff.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\Genetic-2000Elo.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\MAPK-HF96-layout.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\Metabolism-2000Poo.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\NF-kappaB.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\Olsen2003_peroxidase.cps; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\brusselator.sedml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\brusselator-model.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\NF-kappaB.sedml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\NF-kappaB-model.xml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\scan.sedml; DestDir: {app}\share\copasi\examples
Source: {#MyStageDir}\share\copasi\examples\oscli.xml; DestDir: {app}\share\copasi\examples

; VC Redistributable
Source: {#MyStageDir}\bin\32\vcredist_x86.exe; DestDir: {app}; Flags: deleteafterinstall; Check: IsWin32();
Source: {#MyStageDir}\bin\64\vcredist_x64.exe; DestDir: {app}; Flags: deleteafterinstall; Check: IsWin64();

[Icons]
Name: {group}\CopasiUI; Filename: {app}\{#MyAppExeName}; WorkingDir: {userdocs}
Name: {group}\{cm:ProgramOnTheWeb,{#MyAppName}}; Filename: {#MyAppURL}
Name: {group}\License; Filename: {app}\LICENSE.txt
Name: {group}\README; Filename: {app}\README.txt
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; WorkingDir: {userdocs}
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: quicklaunchicon; WorkingDir: {userdocs}

[Run]
Filename: {app}\vcredist_x86.exe; Parameters: /q /norestart; StatusMsg: Installing Microsoft Visual C++ 2017 32 bit Runtime Libraries; Check: InstallSystemRuntime32()
Filename: {app}\vcredist_x64.exe; Parameters: /q /norestart; StatusMsg: Installing Microsoft Visual C++ 2017 64 bit Runtime Libraries; Check: InstallSystemRuntime64()

[Dirs]
Name: {app}\bin
Name: {app}\bin\bearer
Name: {app}\bin\iconengines
Name: {app}\bin\imageformats
Name: {app}\bin\platforms
Name: {app}\bin\printsupport
Name: {app}\share
Name: {app}\share\copasi
Name: {app}\share\copasi\config
Name: {app}\share\copasi\doc
Name: {app}\share\copasi\doc\html
Name: {app}\share\copasi\doc\html\figures
Name: {app}\share\copasi\examples
Name: {app}\share\copasi\icons

[Registry]
Root: HKCR; SubKey: .cps; ValueType: string; ValueData: COPASI.document; Flags: uninsdeletekey; Check: IsAdminUser
Root: HKCR; SubKey: COPASI.document; ValueType: string; ValueData: COPASI File; Flags: uninsdeletekey; Check: IsAdminUser
Root: HKCR; SubKey: COPASI.document\Shell\Open\Command; ValueType: string; ValueData: """{app}\bin\CopasiUI.exe"" ""%1"""; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKCR; Subkey: COPASI.document\DefaultIcon; ValueType: string; ValueData: {app}\share\copasi\icons\CopasiDoc.ico,-1; Flags: uninsdeletevalue; Check: IsAdminUser
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: string; ValueName: COPASIDIR; ValueData: {app}; Check: IsAdminUser
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: expandsz; ValueName: Path; ValueData: "%COPASIDIR%\bin;{olddata}"; Check: UpdateSystemPath
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueType: string; ValueName: "{app}\bin\CopasiUI.exe"; ValueData: "~ WIN7RTM"; Flags: uninsdeletevalue; Check: IsAdminUserAndWindows8
Root: HKCU; SubKey: Software\Classes\.cps; ValueType: string; ValueData: COPASI.document; Flags: uninsdeletekey; Check: IsRegularUser
Root: HKCU; SubKey: Software\Classes\COPASI.document; ValueType: string; ValueData: COPASI File; Flags: uninsdeletekey; Check: IsRegularUser
Root: HKCU; SubKey: Software\Classes\COPASI.document\Shell\Open\Command; ValueType: string; ValueData: """{app}\bin\CopasiUI.exe"" ""%1"""; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Software\Classes\COPASI.document\DefaultIcon; ValueType: string; ValueData: {app}\share\copasi\icons\CopasiDoc.ico,-1; Flags: uninsdeletevalue; Check: IsRegularUser
Root: HKCU; Subkey: Environment; ValueType: string; ValueName: COPASIDIR; ValueData: {app}; Check: IsRegularUser
Root: HKCU; Subkey: Environment; ValueType: expandsz; ValueName: Path; ValueData: "%COPASIDIR%\bin;{olddata}"; Check: UpdateUserPath
Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueType: string; ValueName: "{app}\bin\CopasiUI.exe"; ValueData: "~ WIN7RTM"; Flags: uninsdeletevalue; Check: IsRegularUserAndWindows8

[Code]
type
  RunTimeVersion = array [0..3] of Integer;

function IsWin32(): Boolean;
begin
  Result := not IsWin64;
end;

function IsAdminUser(): Boolean;
begin
  Result := (IsAdminLoggedOn or IsPowerUserLoggedOn);
end;

function IsRegularUser(): Boolean;
begin
  Result := not (IsAdminLoggedOn or IsPowerUserLoggedOn);
end;

function isWindows8(): Boolean;
var
  Version: TWindowsVersion;

begin
  GetWindowsVersionEx(Version);

  Result := ((Version.Major = 6) and (Version.Minor = 2));
end;

function IsAdminUserAndWindows8(): Boolean;
begin
  Result := (IsAdminUser() and isWindows8());
end;

function IsRegularUserAndWindows8(): Boolean;
begin
  Result := (IsRegularUser() and isWindows8());
end;

function IsCopasiInSystemPath(): Boolean;
var
  CurrentPath: String;
  Position: Integer;

begin
  Result := False;

  if RegQueryStringValue(HKLM,
    'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
    'Path', CurrentPath) then
    // Successfully read the value
    begin
      Position := Pos('%COPASIDIR%\bin', CurrentPath);
      if (Position <> 0) then
        // Found an entry to the COPASI binaries in the Path
        begin
          Result := True;
        end;
    end;
end;

function IsCopasiInUserPath(): Boolean;
var
  CurrentPath: String;
  Position: Integer;

begin
  Result := IsCopasiInSystemPath();

  if RegQueryStringValue(HKCU,
    'Environment',
    'Path', CurrentPath) then
    // Successfully read the value
    begin
      Position := Pos('%COPASIDIR%\bin', CurrentPath);
      if (Position <> 0) then
        // Found an entry to the COPASI binaries in the Path
        begin
          Result := True;
        end;
    end;
end;

function UpdateSystemPath(): Boolean;
begin
  Result := (IsAdminUser() and not IsCopasiInSystemPath());
end;

function UpdateUserPath(): Boolean;
begin
  Result := (IsRegularUser() and not IsCopasiInUserPath());
end;

function StrToVersion(str: String): RunTimeVersion;
var
  Version: RunTimeVersion;
  Position: Integer;

begin
  try
    begin
      Position := Pos('.', str);
      Version[0] := StrToInt(Copy(str, 1, Position - 1));
      Delete(str, 1, Position);

      Position := Pos('.', str);
      Version[1] := StrToInt(Copy(str, 1, Position - 1));
      Delete(str, 1, Position);

      Position := Pos('.', str);
      Version[2] := StrToInt(Copy(str, 1, Position - 1));
      Delete(str, 1, Position);

      Version[3] := StrToInt(str);
    end;

  except
    begin
      Version[0] := 0;
      Version[1] := 0;
      Version[2] := 0;
      Version[3] := 0;
    end;
  end;

  Result := Version;
end;

function VersionToStr(Version: RunTimeVersion): String;
begin
  Result := IntToStr(Version[0]) + '.' +
            IntToStr(Version[1]) + '.' +
            IntToStr(Version[2]) + '.' +
            IntToStr(Version[3]);
end;

function CompareVersion(Version1: RunTimeVersion;
                        Version2: RunTimeVersion): Integer;
begin
  if Version1[0] <> Version2[0] then
    Result := Version1[0] - Version2[0]
  else if Version1[1] <> Version2[1] then
    Result := Version1[1] - Version2[1]
  else if Version1[2] <> Version2[2] then
    Result := Version1[2] - Version2[2]
  else
    Result := Version1[3] - Version2[3];
end;

function IsInVersionRange(OldVersionRange: String;
                          Version: RunTimeVersion): Boolean;
var
  LowerBound: RunTimeVersion;
  UpperBound: RunTimeVersion;
  Position: Integer;

begin
  Result := False;
  Position := Pos('-', OldVersionRange);

  if Position <> 0 then
    begin
      LowerBound := StrToVersion(Copy(OldVersionRange, 1, Position - 1));
      UpperBound := StrToVersion(Copy(OldVersionRange, Position + 1, 100));
    end
  else
    begin
      LowerBound := StrToVersion(OldVersionRange);
      UpperBound := LowerBound;
    end;

  if (CompareVersion(LowerBound, Version) <= 0) and
     (CompareVersion(Version, UpperBound) <= 0) then
    begin
      Result := True;
    end;
end;

function HaveRuntime64(): Boolean;
begin
  Result := RegKeyExists(HKEY_CLASSES_ROOT, 'Installer\\Products\\083F30FCC2E18753C8E02308E78B0C8D') or
            RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2CD849A7-86A1-34A6-B8F9-D72F5B21A9AE}');
end;

function HaveRuntime32(): Boolean;
begin
  Result := RegKeyExists(HKEY_CLASSES_ROOT, 'Installer\\Products\\1A57DEF7C006B493386717E2A288162F') or
            RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{56e11d69-7cc9-40a5-a4f9-8f6190c4d84d}')
end;

function InstallSystemRuntime32(): Boolean;
begin
  Result := IsWin32() and IsAdminUser() and not HaveRunTime32();
end;

function InstallSystemRuntime64(): Boolean;
begin
  Result := IsWin64() and IsAdminUser() and not HaveRunTime64();
end;

function InstallUserRuntime32(): Boolean;
begin
  Result := IsWin32() and IsRegularUser() and not HaveRunTime32();
end;

function InstallUserRuntime64(): Boolean;
begin
  Result := IsWin64() and IsRegularUser() and not HaveRunTime64();
end;

function InitializeSetup(): Boolean;
begin
  Result := True;

  RegDeleteValue(HKEY_CURRENT_USER, 'Environment', 'COPASIDIR');
end;

function DefDirRoot(Param: String): String;
begin
  if IsRegularUser() then
    Result := ExpandConstant('{localappdata}')
  else if IsWin64() then
    Result := ExpandConstant('{pf64}')
  else
    Result := ExpandConstant('{pf}');
end;


conditional deinstall of python/gdal

conditional deinstall of python/gdal

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

#define MyAppName "AvNav"
#define MyAppVersion "1.0"
#define MyAppPublisher "Andreas Vogel"
#define MyAppURL "http://www.wellenvogel.de/software/avnav"
#define MyAppExeName "AvChartConvert.exe"
#define RegKey "SOFTWARE\AvNav"
#define PythonMSI "python-2.7.10.msi"
#define PythonCode "{{E2B51919-207A-43EB-AE78-733F9C6797C2}"
#define PythonDir "python"
#define GdalMSI "gdal-111-1500-core.msi"
#define GdalCode "{{A811F26E-D8EE-4DDB-8E23-ED5386E98695}"
#define GdalDir "gdal"
#define GdalPythonMSI "GDAL-1.11.0.win32-py2.7.msi"
#define GdalPythonCode "{{B086ED88-4BB5-46E0-9CDA-8AA8ED2BF906}"
#define KeyInstalledPython "installedPython"
#define KeyInstalledGdal "installedGdal"
#define KeyUnistallBase "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

[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={{832C93A9-F8FA-4EE4-9447-2645D4340A13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
;OutputDir=C:\Users\andreas\Documents\GitHub\avnav\windows\installer
OutputBaseFilename=AvNavSetup
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "..\AvChartConvert.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "..\avnav_server_home.xml"; DestDir: "{app}"; DestName: "avnav_server.xml"
Source: "..\..\server\*.py"; DestDir: "{app}\scripts"
Source: "..\..\chartconvert\*.py"; DestDir: "{app}\scripts"
Source: "library\{#PythonMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalPythonMSI}"; DestDir: "{tmp}"
Source: "..\..\viewer\avnav_min.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\loader.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\version.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.html"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.less"; DestDir: "{app}\viewer"
Source: "..\..\viewer\base.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\images\*.png"; DestDir: "{app}\viewer\images"
Source: "..\..\libraries\*"; DestDir: "{app}\libraries"; Flags: recursesubdirs; Excludes: "*.pyc,*debug.js"

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#PythonMSI}"" /qb TARGETDIR=""{app}\{#PythonDir}"""; WorkingDir: "{tmp}"; Check: checkInstallPython
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"; Check: checkInstallGdal
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalPythonMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"; Check: checkInstallGdal

[Registry]
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: createvalueifdoesntexist  uninsdeletekey
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledPython}"; ValueData: "true"; Flags: createvalueifdoesntexist uninsdeletekey; Check: checkInstallPython
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledGdal}"; ValueData: "true"; Flags: createvalueifdoesntexist uninsdeletekey; Check: checkInstallGdal

[Code]
function BoolToStr(ip:Boolean): string;
begin
  if ip then
  begin
    Result:='true';
  end else begin
    Result:='false';
  end;
end;

function isProductInstalled(ProductCode: String): Boolean;
var rkey:string;
begin
  rkey:=ExpandConstant('{#KeyUnistallBase}')+ProductCode;
  Log('isProductInstalled '+rkey);
  Result:=RegKeyExists(HKEY_LOCAL_MACHINE,rkey);
end;

var
OptionPage: TInputOptionWizardPage;
uninstallPython: Boolean;
uninstallGdal: Boolean;
procedure InitializeWizard;
var
subcap:String;
pythonInstalled:Boolean;
gdalInstalled: Boolean;

begin
  { Create the pages }
  subcap:='If select to install python/gdal the embedded python/gdal will become your default';
  pythonInstalled:=isProductInstalled(ExpandConstant('{#PythonCode}'));
  Log('pythonInstalled: '+BoolToStr(pythonInstalled));
  gdalInstalled:=isProductInstalled(ExpandConstant('{#GdalCode}'));
  Log('gdalInstalled: '+BoolToStr(gdalInstalled));
  if pythonInstalled then begin
    subcap:=subcap+#13+'HINT: Python 2.7 is already installed';
  end;
  if gdalInstalled then begin
    subcap:=subcap+#13+'HINT: gdal is already installed';
  end;
  OptionPage := CreateInputOptionPage(wpWelcome,
    'Install Python/GDAL', 'Select if you want to install the embedded python/gdal',
    subcap,
    True, False);
  OptionPage.AddEx('Install Python',0,false);
  OptionPage.AddEx('Install GDAL',0,false);
  OptionPage.Values[0]:= not pythonInstalled;
  OptionPage.Values[1]:= not gdalInstalled;
end;

function checkInstall(index:integer): Boolean;
begin
  Result:=OptionPage.Values[index];
end;

function checkInstallPython(): Boolean;
begin
  Result:=checkInstall(0);
end;

function checkInstallGdal(): Boolean;
begin
  Result:=checkInstall(1);
end;

//check if a feature was installed by us
function CheckFeature(Name:String;Key:String): Boolean;
var
  path: String;
  isInstalledByUs: string;
  dirpath: string;
  rkey: string;
begin
  Result:= False;
  rkey:=ExpandConstant('{#RegKey}');
  if RegQueryStringValue(HKEY_LOCAL_MACHINE,rkey,Key,isInstalledByUs) then begin
    if isInstalledByUs = 'true' then begin
      if RegQueryStringValue(HKEY_LOCAL_MACHINE, rkey,'InstallDir', path) then  begin
        dirpath:=path+'\'+Name;
        Result:=DirExists(dirpath);
      end;
    end;
  end;
end;

procedure DeinstallFeature(fkey:String);
var
  ResultCode: Integer;
begin
    Exec('msiexec.exe', '/x '+fkey+' /qb', '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode)
    Log('Deinstall for '+fkey+' ended with '+IntToStr(ResultCode));
end;

function InitializeUninstall(): Boolean;
begin
  Result:=true;
  uninstallPython:=checkFeature(ExpandConstant('{#PythonDir}'),ExpandConstant('{#KeyInstalledPython}'));
  uninstallGdal:=checkFeature(ExpandConstant('{#GdalDir}'),ExpandConstant('{#KeyInstalledGdal}'));
end;
//take the uninstall id from the properties of the MSI
//getmsiinfo.py library\python-2.7.10.msi "ProductCode"
//would be better to check for the python install dir...
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then begin
    if uninstallPython then
    begin
      DeinstallFeature(ExpandConstant('{#PythonCode}'));
    end;
    if uninstallGdal then
    begin
      DeinstallFeature(ExpandConstant('{#GdalCode}'));
      DeinstallFeature(ExpandConstant('{#GdalPythonCode}'));
    end;
  end;
end;

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

#define MyAppName "AvNav"
#define MyAppVersion "1.0"
#define MyAppPublisher "Andreas Vogel"
#define MyAppURL "http://www.wellenvogel.de/software/avnav"
#define MyAppExeName "AvChartConvert.exe"
#define RegKey "Software\AvNav"
#define PythonMSI "python-2.7.10.msi"
#define PythonCode "{{E2B51919-207A-43EB-AE78-733F9C6797C2}"
#define PythonDir "python"
#define GdalMSI "gdal-111-1500-core.msi"
#define GdalCode "{{A811F26E-D8EE-4DDB-8E23-ED5386E98695}"
#define GdalDir "gdal"
#define GdalPythonMSI "GDAL-1.11.0.win32-py2.7.msi"
#define GdalPythonCode "{{B086ED88-4BB5-46E0-9CDA-8AA8ED2BF906}"
#define KeyInstalledPython "installedPython"
#define KeyInstalledGdal "installedGdal"

[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={{832C93A9-F8FA-4EE4-9447-2645D4340A13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
;OutputDir=C:\Users\andreas\Documents\GitHub\avnav\windows\installer
OutputBaseFilename=AvNavSetup
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "..\AvChartConvert.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "..\avnav_server_home.xml"; DestDir: "{app}"; DestName: "avnav_server.xml"
Source: "..\..\server\*.py"; DestDir: "{app}\scripts"
Source: "..\..\chartconvert\*.py"; DestDir: "{app}\scripts"
Source: "library\{#PythonMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalMSI}"; DestDir: "{tmp}"
Source: "library\{#GdalPythonMSI}"; DestDir: "{tmp}"
Source: "..\..\viewer\avnav_min.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\loader.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\version.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.html"; DestDir: "{app}\viewer"
Source: "..\..\viewer\avnav_viewer.less"; DestDir: "{app}\viewer"
Source: "..\..\viewer\base.js"; DestDir: "{app}\viewer"
Source: "..\..\viewer\images\*.png"; DestDir: "{app}\viewer\images"
Source: "..\..\libraries\*"; DestDir: "{app}\libraries"; Flags: recursesubdirs; Excludes: "*.pyc,*debug.js"

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#PythonMSI}"" /qb TARGETDIR=""{app}\{#PythonDir}"""; WorkingDir: "{tmp}"
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\{#GdalPythonMSI}"" /qb TARGETDIR=""{app}\{#GdalDir}"" INSTALLDIR=""{app}\{#GdalDir}"""; WorkingDir: "{tmp}"

[Registry]
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: createvalueifdoesntexist
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledPython}"; ValueData: "true"; Flags: createvalueifdoesntexist
Root: "HKLM"; Subkey: "{#RegKey}"; ValueType: string; ValueName: "{#KeyInstalledGdal}"; ValueData: "true"; Flags: createvalueifdoesntexist
[Code]
function CheckFeature(Name:String;Key:String): Boolean;
var
  path: String;
  isInstalledByUs: string;
begin
  Result:= False;
  if RegQueryStringValue(HKEY_LOCAL_MACHINE,ExpandConstant('{#RegKey}'),Key,isInstalledByUs) then begin
    if isInstalledByUs = 'true' then begin
      if RegQueryStringValue(HKEY_LOCAL_MACHINE, ExpandConstant('{#RegKey}'),'InstallDir', path) then  begin
        Result:=DirExists(path+'\'+Name);
      end
      else begin
        MsgBox('unable to read reg ',mbInformation, MB_OK);
      end;
    end;
  end;
end;

procedure DeinstallFeature(name:String;ikey: String;fkey:String);
var
  ResultCode: Integer;
begin
  if CheckFeature(name,ikey) then begin
    Exec('msiexec.exe', '/x '+fkey+' /qb', '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode)
    Log('Deinstall for '+name+' ended with '+IntToStr(ResultCode));
  end else begin
    Log('Deinstall for '+name+' skipped');
  end;
end;

//take the uninstall id from the properties of the MSI
//getmsiinfo.py library\python-2.7.10.msi "ProductCode"
//would be better to check for the python install dir...
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then begin
    DeinstallFeature(ExpandConstant('{#PythonDir}'),ExpandConstant('{#KeyInstalledPython}'),ExpandConstant('{#PythonCode}'));
    DeinstallFeature(ExpandConstant('{#GdalDir}'),ExpandConstant('{#KeyInstalledGdal}'),ExpandConstant('{#GdalCode}'));
    DeinstallFeature(ExpandConstant('{#GdalDir}'),ExpandConstant('{#KeyInstalledGdal}'),ExpandConstant('{#GdalPythonCode}'));
  end;
end;


Bugfix: The HTML help file's icon was pointing to a non excisting file.

Suggested by: David Resnick <david@til.co.il>

* packages/win32-innosetup/svn.iss:
  (ICONS): Switch svn-doc.chm's "IconFilename: {app}\svn.exe" with
           "IconFilename: {app}\bin\svn.exe"

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@849691 13f79535-47bb-0310-9956-ffa450edef68

[Setup]
;# Version parameters #########################################################
#define svn_cpr "Copyright 2000-2004 CollabNet"

; Version and release info:
#include "svn_version.iss"

;# svn_dynamics.iss ###########################################################
; This file contains all the paths needed by inno for finding the sources to
; compile a Windows Setup for Subversion.
; A template of the file can be found in the Subversion repository:
;     packages\win32-innosetup\tools\templates
; Copy svn_dynamics.iss to the same folder as this file and read the
; documentation inside it.
#include "svn_dynamics.iss"

AppName=Subversion
AppVerName=Subversion-{#= svn_version}{#= svn_pretxtrevision}{#= svn_revision}
AppPublisher=CollabNet
AppPublisherURL=http://subversion.tigris.org/
AppSupportURL=http://subversion.tigris.org/project_faq.html
AppUpdatesURL=http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
DefaultDirName={pf}\Subversion
DefaultGroupName=Subversion
LicenseFile={#= path_setup_in}\subversion\SubversionLicense.txt
OutputDir={#= path_setup_out}
OutputBaseFilename=svn-{#= svn_version}-setup
Compression=lzma
InternalCompressLevel=max
SolidCompression=true
AppCopyright={#= svn_cpr}
UninstallDisplayIcon={app}\svn.exe
UninstallDisplayName=Subversion {#= svn_version}{#= svn_pretxtrevision}{#= svn_revision} (Uninstall)
AlwaysShowDirOnReadyPage=true
AlwaysShowGroupOnReadyPage=true
InfoAfterFile=Post.rtf
InfoBeforeFile=Pre.rtf
DisableStartupPrompt=false
UseSetupLdr=true
AppVersion={#= svn_version}{#= svn_pretxtrevision}{#= svn_revision}
VersionInfoVersion={#= svn_version}
VersionInfoDescription=Subversion-{#= svn_version} Windows Setup
WizardImageFile=images\wiz-164x314x24.bmp
WizardSmallImageFile=images\wiz-55x55x24.bmp
RestartIfNeededByRun=false
ShowTasksTreeLines=true
AllowNoIcons=true
ShowLanguageDialog=no

[Tasks]
Name: desktopicon; Description: Create &desktop icon for the Subversion documentation; GroupDescription: Desktop icons:
Name: quicklaunchicon; Description: Create &Quick Launch icon for the Subversion Documentation; GroupDescription: Quick Launch icons:; MinVersion: 4.01.1998,5.00.2195
Name: apachehandler; Description: Install and configure Subversion modules (the Setup will do a stop/uninstall/configure/install/start cycle of the Apache service); GroupDescription: Apache modules:; MinVersion: 0,4.0.1381; Check: ApacheTask

[Files]
; Subversion files --------------------------------------------------------------
Source: in\subversion\Readme.dist; DestDir: {app}; DestName: Readme.txt
Source: W32notes.txt; DestDir: {app}
Source: {#= path_setup_in}\subversion\svn-proxy-template.reg; DestDir: {app}; Flags: ignoreversion
Source: {#= path_svnclient}\..\README.txt; DestDir: {app}; DestName: Buildnotes.txt
Source: {#= path_svnclient}\svn.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnadmin}\svnadmin.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnlook}\svnlook.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnserve}\svnserve.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnversion}\svnversion.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svndumpfilter}\svndumpfilter.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_brkdb_dll}\{#= libdb_dll}; DestDir: {app}\bin
Source: {#= path_iconv}\*.so; DestDir: {app}\iconv; Flags: ignoreversion

Source: {#= path_setup_in}\berkeley\BerkeleyLicense.txt; DestDir: {app}
Source: {#= path_setup_in}\doc\svn-doc.chm; DestDir: {app}\doc

; VC7 Runtime
#ifdef VC7
Source: {#= path_msvcr70_dll}\msvcr70.dll; DestDir: {sys}; Flags: sharedfile uninsneveruninstall onlyifdoesntexist
#endif

;SSL
Source: {#= path_ssl}\libeay32.dll; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_ssl}\ssleay32.dll; DestDir: {app}\bin; Flags: ignoreversion

; Missing stuff
Source: missing_msvcp60dll.html; DestDir: {app}\doc; Check: VCRuntimeNotFound
Source: missing_shfolderdll.html; DestDir: {app}\doc; Check: ShFolderDllNotFound

; httpd modules
Source: {#= path_davsvn}\mod_dav_svn.so; DestDir: {app}\httpd; Flags: ignoreversion
Source: {#= path_authzsvn}\mod_authz_svn.so; DestDir: {app}\httpd; Flags: ignoreversion

;Helpers ---------------------------------------------------------------------
Source: {#= path_svnpath}\svnpath.exe; DestDir: {app}\helpers; Flags: ignoreversion

; Debug symbols;
#ifdef inc_dbgsyms
Source: {#= path_svnclient_pdb}\svn.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnadmin_pdb}\svnadmin.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnlook_pdb}\svnlook.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnserve_pdb}\svnserve.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnversion_pdb}\svnversion.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svndumpfilter_pdb}\svndumpfilter.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb

Source: {#= path_davsvn_pdb}\mod_dav_svn.pdb; DestDir: {app}\httpd; Flags: ignoreversion; Components: pdb
Source: {#= path_authzsvn_pdb}\mod_authz_svn.pdb; DestDir: {app}\httpd; Flags: ignoreversion; Components: pdb

Source: {#= path_iconv_pdb}\*.pdb; DestDir: {app}\iconv; Flags: ignoreversion; Components: pdb
#endif

; Internet Shortcuts ----------------------------------------------------------
Source: svn.url; DestDir: {app}

[INI]
Filename: {app}\svn.url; Section: InternetShortcut; Key: URL; String: http://subversion.tigris.org/

[Icons]
Name: {group}\Subversion on the Web; Filename: {app}\svn.url
Name: {group}\Uninstall Subversion; Filename: {uninstallexe}
Name: {group}\Licenses\Subversion; Filename: {app}\SubversionLicense.txt
Name: {group}\Licenses\Berkeley DB Licence; Filename: {app}\BerkeleyLicense.txt
Name: {group}\Subversion Documentation; Filename: {app}\doc\svn-doc.chm; IconFilename: {app}\bin\svn.exe; Comment: The standard Subversion documentation; IconIndex: 0
Name: {userdesktop}\Subversion Documentation; Filename: {app}\doc\svn-doc.chm; IconFilename: {app}\svn.exe; Comment: The standard Subversion documentation; IconIndex: 0; Tasks: desktopicon
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Subversion Documentation; Filename: {app}\doc\svn-doc.chm; Comment: The standard Subversion Documentation; IconFilename: {app}\svn.exe; IconIndex: 0; MinVersion: 4.01.1998,5.00.2195; Tasks: quicklaunchicon
Name: {group}\Read Me; Filename: {app}\Readme.txt
Name: {group}\Download and install msvcp60.dll; Filename: {app}\doc\missing_msvcp60dll.html; Check: VCRuntimeNotFound
Name: {group}\Download and install shfolder.dll; Filename: {app}\doc\missing_shfolderdll.html; Check: ShFolderDllNotFound

[UninstallDelete]
Type: files; Name: {app}\svn.url

[Types]
#ifdef inc_dbgsyms
Name: standard; Description: Standard installation - Binaries only
Name: full; Description: Full installation - Binaries and debugging symbols
Name: custom; Description: Custom Installation; Flags: iscustom

[Components]
Name: main; Description: Subversion application files; Types: standard custom full
Name: pdb; Description: Debug Symbol Files; Types: full custom
#endif

[Registry]
Root: HKCU; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueData: {app}\svn.exe; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueName: Path; ValueData: {app}; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Version; ValueData: {#= svn_version}; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Revision; ValueData: {#= svn_revision}; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; Subkey: Environment; ValueType: string; ValueName: APR_ICONV_PATH; ValueData: {app}\iconv; Flags: uninsdeletevalue noerror

Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueData: {app}\svn.exe; Flags: noerror uninsdeletekeyifempty uninsdeletevalue
Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueName: Path; ValueData: {app}; Flags: uninsdeletekeyifempty uninsdeletevalue noerror
Root: HKLM; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Version; ValueData: {#= svn_version}; Flags: noerror uninsdeletekey
Root: HKLM; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Revision; ValueData: {#= svn_revision}; Flags: uninsdeletevalue noerror uninsdeletekeyifempty
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: string; ValueName: APR_ICONV_PATH; ValueData: {app}\iconv; Flags: uninsdeletevalue noerror

[Run]
Filename: {app}\helpers\svnpath.exe; Parameters: "add ""{app}\bin"""

[UninstallRun]
Filename: {app}\helpers\svnpath.exe; Parameters: "remove ""{app}\bin"""

[Code]
#include "is_main.pas"

[Setup]
;# Version parameters #########################################################
#define svn_cpr "Copyright 2000-2004 CollabNet"

; Version and release info:
#include "svn_version.iss"

;# svn_dynamics.iss ###########################################################
; This file contains all the paths needed by inno for finding the sources to
; compile a Windows Setup for Subversion.
; A template of the file can be found in the Subversion repository:
;     packages\win32-innosetup\tools\templates
; Copy svn_dynamics.iss to the same folder as this file and read the
; documentation inside it.
#include "svn_dynamics.iss"

AppName=Subversion
AppVerName=Subversion-{#= svn_version}{#= svn_pretxtrevision}{#= svn_revision}
AppPublisher=CollabNet
AppPublisherURL=http://subversion.tigris.org/
AppSupportURL=http://subversion.tigris.org/project_faq.html
AppUpdatesURL=http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
DefaultDirName={pf}\Subversion
DefaultGroupName=Subversion
LicenseFile={#= path_setup_in}\subversion\SubversionLicense.txt
OutputDir={#= path_setup_out}
OutputBaseFilename=svn-{#= svn_version}-setup
Compression=lzma
InternalCompressLevel=max
SolidCompression=true
AppCopyright={#= svn_cpr}
UninstallDisplayIcon={app}\svn.exe
UninstallDisplayName=Subversion {#= svn_version}{#= svn_pretxtrevision}{#= svn_revision} (Uninstall)
AlwaysShowDirOnReadyPage=true
AlwaysShowGroupOnReadyPage=true
InfoAfterFile=Post.rtf
InfoBeforeFile=Pre.rtf
DisableStartupPrompt=false
UseSetupLdr=true
AppVersion={#= svn_version}{#= svn_pretxtrevision}{#= svn_revision}
VersionInfoVersion={#= svn_version}
VersionInfoDescription=Subversion-{#= svn_version} Windows Setup
WizardImageFile=images\wiz-164x314x24.bmp
WizardSmallImageFile=images\wiz-55x55x24.bmp
RestartIfNeededByRun=false
ShowTasksTreeLines=true
AllowNoIcons=true
ShowLanguageDialog=no

[Tasks]
Name: desktopicon; Description: Create &desktop icon for the Subversion documentation; GroupDescription: Desktop icons:
Name: quicklaunchicon; Description: Create &Quick Launch icon for the Subversion Documentation; GroupDescription: Quick Launch icons:; MinVersion: 4.01.1998,5.00.2195
Name: apachehandler; Description: Install and configure Subversion modules (the Setup will do a stop/uninstall/configure/install/start cycle of the Apache service); GroupDescription: Apache modules:; MinVersion: 0,4.0.1381; Check: ApacheTask

[Files]
; Subversion files --------------------------------------------------------------
Source: in\subversion\Readme.dist; DestDir: {app}; DestName: Readme.txt
Source: W32notes.txt; DestDir: {app}
Source: {#= path_setup_in}\subversion\svn-proxy-template.reg; DestDir: {app}; Flags: ignoreversion
Source: {#= path_svnclient}\..\README.txt; DestDir: {app}; DestName: Buildnotes.txt
Source: {#= path_svnclient}\svn.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnadmin}\svnadmin.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnlook}\svnlook.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnserve}\svnserve.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svnversion}\svnversion.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_svndumpfilter}\svndumpfilter.exe; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_brkdb_dll}\{#= libdb_dll}; DestDir: {app}\bin
Source: {#= path_iconv}\*.so; DestDir: {app}\iconv; Flags: ignoreversion

Source: {#= path_setup_in}\berkeley\BerkeleyLicense.txt; DestDir: {app}
Source: {#= path_setup_in}\doc\svn-doc.chm; DestDir: {app}\doc

; VC7 Runtime
#ifdef VC7
Source: {#= path_msvcr70_dll}\msvcr70.dll; DestDir: {sys}; Flags: sharedfile uninsneveruninstall onlyifdoesntexist
#endif

;SSL
Source: {#= path_ssl}\libeay32.dll; DestDir: {app}\bin; Flags: ignoreversion
Source: {#= path_ssl}\ssleay32.dll; DestDir: {app}\bin; Flags: ignoreversion

; Missing stuff
Source: missing_msvcp60dll.html; DestDir: {app}\doc; Check: VCRuntimeNotFound
Source: missing_shfolderdll.html; DestDir: {app}\doc; Check: ShFolderDllNotFound

; httpd modules
Source: {#= path_davsvn}\mod_dav_svn.so; DestDir: {app}\httpd; Flags: ignoreversion
Source: {#= path_authzsvn}\mod_authz_svn.so; DestDir: {app}\httpd; Flags: ignoreversion

;Helpers ---------------------------------------------------------------------
Source: {#= path_svnpath}\svnpath.exe; DestDir: {app}\helpers; Flags: ignoreversion

; Debug symbols;
#ifdef inc_dbgsyms
Source: {#= path_svnclient_pdb}\svn.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnadmin_pdb}\svnadmin.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnlook_pdb}\svnlook.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnserve_pdb}\svnserve.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svnversion_pdb}\svnversion.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb
Source: {#= path_svndumpfilter_pdb}\svndumpfilter.pdb; DestDir: {app}\bin; Flags: ignoreversion; Components: pdb

Source: {#= path_davsvn_pdb}\mod_dav_svn.pdb; DestDir: {app}\httpd; Flags: ignoreversion; Components: pdb
Source: {#= path_authzsvn_pdb}\mod_authz_svn.pdb; DestDir: {app}\httpd; Flags: ignoreversion; Components: pdb

Source: {#= path_iconv_pdb}\*.pdb; DestDir: {app}\iconv; Flags: ignoreversion; Components: pdb
#endif

; Internet Shortcuts ----------------------------------------------------------
Source: svn.url; DestDir: {app}

[INI]
Filename: {app}\svn.url; Section: InternetShortcut; Key: URL; String: http://subversion.tigris.org/

[Icons]
Name: {group}\Subversion on the Web; Filename: {app}\svn.url
Name: {group}\Uninstall Subversion; Filename: {uninstallexe}
Name: {group}\Licenses\Subversion; Filename: {app}\SubversionLicense.txt
Name: {group}\Licenses\Berkeley DB Licence; Filename: {app}\BerkeleyLicense.txt
Name: {group}\Subversion Documentation; Filename: {app}\doc\svn-doc.chm; IconFilename: {app}\svn.exe; Comment: The standard Subversion documentation; IconIndex: 0
Name: {userdesktop}\Subversion Documentation; Filename: {app}\doc\svn-doc.chm; IconFilename: {app}\svn.exe; Comment: The standard Subversion documentation; IconIndex: 0; Tasks: desktopicon
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Subversion Documentation; Filename: {app}\doc\svn-doc.chm; Comment: The standard Subversion Documentation; IconFilename: {app}\svn.exe; IconIndex: 0; MinVersion: 4.01.1998,5.00.2195; Tasks: quicklaunchicon
Name: {group}\Read Me; Filename: {app}\Readme.txt
Name: {group}\Download and install msvcp60.dll; Filename: {app}\doc\missing_msvcp60dll.html; Check: VCRuntimeNotFound
Name: {group}\Download and install shfolder.dll; Filename: {app}\doc\missing_shfolderdll.html; Check: ShFolderDllNotFound

[UninstallDelete]
Type: files; Name: {app}\svn.url

[Types]
#ifdef inc_dbgsyms
Name: standard; Description: Standard installation - Binaries only
Name: full; Description: Full installation - Binaries and debugging symbols
Name: custom; Description: Custom Installation; Flags: iscustom

[Components]
Name: main; Description: Subversion application files; Types: standard custom full
Name: pdb; Description: Debug Symbol Files; Types: full custom
#endif

[Registry]
Root: HKCU; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueData: {app}\svn.exe; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueName: Path; ValueData: {app}; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Version; ValueData: {#= svn_version}; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Revision; ValueData: {#= svn_revision}; Flags: uninsdeletekeyifempty uninsdeletevalue
Root: HKCU; Subkey: Environment; ValueType: string; ValueName: APR_ICONV_PATH; ValueData: {app}\iconv; Flags: uninsdeletevalue noerror

Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueData: {app}\svn.exe; Flags: noerror uninsdeletekeyifempty uninsdeletevalue
Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\svn.exe; ValueType: string; ValueName: Path; ValueData: {app}; Flags: uninsdeletekeyifempty uninsdeletevalue noerror
Root: HKLM; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Version; ValueData: {#= svn_version}; Flags: noerror uninsdeletekey
Root: HKLM; SubKey: SOFTWARE\Tigris.org\Subversion; ValueType: string; ValueName: Revision; ValueData: {#= svn_revision}; Flags: uninsdeletevalue noerror uninsdeletekeyifempty
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: string; ValueName: APR_ICONV_PATH; ValueData: {app}\iconv; Flags: uninsdeletevalue noerror

[Run]
Filename: {app}\helpers\svnpath.exe; Parameters: "add ""{app}\bin"""

[UninstallRun]
Filename: {app}\helpers\svnpath.exe; Parameters: "remove ""{app}\bin"""

[Code]
#include "is_main.pas"


Updating InnoSetup script.

Updating InnoSetup script.

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

#define MyAppName "KlustaViewa"
#define MyAppVersion "0.3.0dev"
#define MyAppPublisher "Klusta-Team"
#define MyAppURL "https://klusta-team.github.io"

[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={{E271F842-D4CF-4D8D-8421-EEEFB8347E98}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
SetupIconFile=D:\Git\klustaviewa\klustaviewa\icons\favicon.ico
Compression=zip
WizardImageFile=wizard.bmp
WizardImageStretch=no
WizardSmallImageFile=wizard-small.bmp
WizardImageBackColor=$ffffff
OutputBaseFilename=klustaviewa-setup
OutputDir=.
ChangesAssociations=yes

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

[Files]
Source: "D:\Git\klustaviewa\dev\wininstaller\KlustaViewa\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
; KlustaViewa
Name: "{group}\KlustaViewa"; Filename: "{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\Scripts\klustaviewa.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"
Name: "{userdesktop}\KlustaViewa"; Filename: "{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\Scripts\klustaviewa.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"

; KwikSkope
;Name: "{group}\KwikSkope"; Filename: "{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\Scripts\kwikskope.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"
;Name: "{userdesktop}\KwikSkope"; Filename: "{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\Scripts\kwikskope.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"

; Update and Uninstall
;Name: "{group}\Update KlustaViewa"; Filename: "{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\python.exe"; WorkingDir: "{app}"; Parameters: """{app}\tools\update.py""";
;Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\python.exe"; WorkingDir: "{app}"; Parameters: """{app}\tools\update.py"""; Flags: runhidden

[Dirs]
Name: "{app}\"; Permissions: everyone-modify

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\Scripts"; Check: NeedsAddPath('{app}\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\Scripts')
Root: HKCR; Subkey: ".kwik"; ValueType: string; ValueName: ""; ValueData: "Kwik spike file"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "KlustaViewa"; ValueType: string; ValueName: ""; ValueData: "KlustaViewa"; Flags: uninsdeletekey
Root: HKCR; Subkey: "KlustaViewa\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\favicon.ico"
Root: HKCR; Subkey: "KlustaViewa\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts\klustaviewa.exe"" ""%1"""

[Code]
function NeedsAddPath(Param: string): boolean;
var
  OrigPath: string;
begin
  if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
    'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
    'Path', OrigPath)
  then begin
    Result := True;
    exit;
  end;
  // look for the path with leading and trailing semicolon
  // Pos() returns 0 if not found
  Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;

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

#define MyAppName "KlustaViewa"
#define MyAppVersion "0.2.0dev"
#define MyAppPublisher "Klusta-Team"
#define MyAppURL "https://github.com/klusta-team/klustaviewa"

[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={{E271F842-D4CF-4D8D-8421-EEEFB8347E98}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
SetupIconFile=D:\Git\klustaviewa\klustaviewa\icons\favicon.ico
Compression=zip
WizardImageFile=wizard.bmp
WizardImageStretch=no
WizardSmallImageFile=wizard-small.bmp
WizardImageBackColor=$ffffff
OutputBaseFilename=klustaviewa-setup
OutputDir=.
ChangesAssociations=yes

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

[Files]
Source: "D:\Git\klustaviewa\dev\wininstaller\KlustaViewa\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
; KlustaViewa
Name: "{group}\KlustaViewa"; Filename: "{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts\klustaviewa.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"
Name: "{userdesktop}\KlustaViewa"; Filename: "{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts\klustaviewa.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"

; KwikSkope
Name: "{group}\KwikSkope"; Filename: "{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts\kwikskope.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"
Name: "{userdesktop}\KwikSkope"; Filename: "{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts\kwikskope.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\favicon.ico"

; Update and Uninstall
Name: "{group}\Update KlustaViewa"; Filename: "{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\python.exe"; WorkingDir: "{app}"; Parameters: """{app}\tools\update.py""";
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\python.exe"; WorkingDir: "{app}"; Parameters: """{app}\tools\update.py"""; Flags: runhidden

[Dirs]
Name: "{app}\"; Permissions: everyone-modify

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts"; Check: NeedsAddPath('{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts')
Root: HKCR; Subkey: ".kwik"; ValueType: string; ValueName: ""; ValueData: "Kwik spike file"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "KlustaViewa"; ValueType: string; ValueName: ""; ValueData: "KlustaViewa"; Flags: uninsdeletekey
Root: HKCR; Subkey: "KlustaViewa\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\favicon.ico"
Root: HKCR; Subkey: "KlustaViewa\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\WinPython-64bit-2.7.5.2\python-2.7.5.amd64\Scripts\klustaviewa.exe"" ""%1"""

[Code]
function NeedsAddPath(Param: string): boolean;
var
  OrigPath: string;
begin
  if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
    'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
    'Path', OrigPath)
  then begin
    Result := True;
    exit;
  end;
  // look for the path with leading and trailing semicolon
  // Pos() returns 0 if not found
  Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;