No comment.

No comment.

; C S O U N D   6   I N N O   S E T U P   S C R I P T

; Copyright (C) 2013 by Michael Gogins.
; This software is licensed under the terms of the
; Lesser (or Library) GNU Public License.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

; This file assumes that you are Michael Gogins,
; but comments indicate what you should change if you are not me.
; All of these changes SHOULD be in the #defines immediately following this.
; Also, this installer assumes LuaJIT and CsoundAC are part of Csound core.
; At this time the following features are not included in the installer:
; Cabbage, CsoundVST, CsoundQt, the Java API.
; I hope to change this soon.

#define MyAppName "Csound6"
#define MyAppVersion ""
#define MyAppMinVersion "1"
#define MyAppPublisher "Csound"
#define MyAppURL "http://sourceforge.net/projects/csound"
; If you are not Michael Gogins, change this to your MinGW dll directory.
#define MyMinGwBinDir "C:\mingw32-4.7.2\bin\"
; If you are not Michael Gogins, change this to your Csound build directory.
#define MySourceDir "C:\Users\Michael\csound-csound6-git\"
; If you are not Michael Gogins, change this to your Csound reference manual build directory.
#define MyManualSourceDir "C:\Users\Michael\csound-manual6-git\"
; If you are not Michael Gogins, change this to your Csound tutorial directory.
#define MyCsoundTutorialSourceDir "D:\Dropbox\tutorial\"
; If you are not Michael Gogins, change this to your CsoundAC tutorial directory.
#define MyCsoundAcTutorialSourceDir "D:\Dropbox\tutorial\"
; If you are not Michael Gogins, change this to your libsndfile install directory.
#define MyLibSndfileSourceDir "C:\mingw32-4.7.2\msys\1.0\local\lib\libsndfile\"
; If you are not Michael Gogins, change this to your PortAudio lib directory.
#define MyPortAudioSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\portaudio\"
; If you are not Michael Gogins, change this to your PortMidi build directory.
#define MyPortMidiSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\portmidi\"
; If you are not Michael Gogins, change this to your LuaJIT bin directory.
#define MyLuaJitSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\luajit-2.0\src\"
; If you are not Michael Gogins, change this to your FLTK dll directory.
#define MyFltkSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\fltk-1.3.2\src\"
; If you are not Michael Gogins, change this to your libmusicxml dll directory.
#define MyLibMusicXmlSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\libmusicxml-3.00-src\cmake\"
; If you are not Michael Gogins, change this to your FluidSynth dll directory.
#define MyFluidSynthSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\fluidsynth\src\.libs\"
; If you are not Michael Gogins, change this to your OSC library dll directory.
#define MyLibLoSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\liblo-0.26\"
; If you are not Michael Gogins, change this to your STK dll directory.
#define MyLibStkSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\stk-4.4.4\"

[Components]
Name: "core"; Description: "Core Csound"; Types: full custom; Flags: fixed
Name: "python"; Description: "Python features (requires Python 2.7)"; Types: full;

[Dirs]
; ALL programs and shared libraries (including opcodes and other modules) go here.
Name: "{app}\bin"
#define APP_BIN "{app}\bin\"
; All C or C++ include files for Csound and other components used by Csound go here.
; This is a convenience for people like me who program in C or C++ and might use
; features of these third party components.
Name: "{app}\include"
#define APP_INCLUDE "{app}\include\"
; The Csound reference manual goes here.
Name: "{app}\doc\manual"
#define APP_MANUAL "{app}\doc\manual\"
; The Csound API reference manuals go here.
Name: "{app}\doc\apiref"
#define APP_APIREF "{app}\doc\apiref\"
; All Csound examples go here.
#define APP_EXAMPLES "{app}\examples\"
; Any SoundFonts or sound samples used by Csound examples go here.
Name: "{app}\samples"
#define APP_SAMPLES "{app}\samples\"
; Tutorials go here.
Name: "{app}\doc\tutorial"
#define APP_TUTORIAL "{app}\doc\tutorial\"

; These are the Csound environment variables related to directories.

#define SFDIR
#define SSDIR
#define SADIR
#define INCDIR
#define OPCODE6DIR64
#define SNAPDIR
#define RAWWAVE_PATH
#define MFDIR
#define PYTHONPATH

[Setup]
ChangesEnvironment=true
; 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={{4BCEDC5F-C6D2-4869-9097-3F1753739F35}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppMinVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName=Csound 6
AllowNoIcons=yes
LicenseFile=readme-csound6.txt
;InfoBeforeFile=readme-csound6.txt
OutputDir=installer\windows
OutputBaseFilename=Setup_{#MyAppName}_{#MyAppMinVersion}
Compression=lzma
SolidCompression=yes
SourceDir={#MySourceDir}

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

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "{#MyMinGwBinDir}*.dll"; DestDir: "{#APP_BIN}"; Components: core;
Source: "*.exe"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: core;
Source: "*.dll"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Excludes: "py.dll"; Components: core;
Source: "py.dll"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: python;
Source: "*.pyd"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: python;
Source: "*.py";  DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: python;

Source: {#MyLibSndfileSourceDir}\bin\*.*; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: core;
Source: {#MyLibSndfileSourceDir}\include\*.*; DestDir: "{#APP_INCLUDE}\sndfile"; Flags: ignoreversion; Components: core;

Source: {#MyPortAudioSourceDir}lib\.libs\*.dll; DestDir: "{#APP_BIN}"; Components: core
Source: {#MyPortAudioSourceDir}bin\.libs\pa_devs.exe; DestDir: "{#APP_BIN}"; Components: core
Source: {#MyPortAudioSourceDir}bin\.libs\pa_minlat.exe; DestDir: "{#APP_BIN}"; Components: core

Source: {#MyPortMidiSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: core

Source: {#MyLuaJitSourceDir}luajit.exe; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyLuaJitSourceDir}lua51.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core
Source: {#MyLuaJitSourceDir}lua*.h; DestDir: "{#APP_INCLUDE}\luajit"; Flags: ignoreversion;  Components: core

Source: {#MyFltkSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyLibMusicXmlSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyFluidSynthSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyLibLoSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: include/*.h*; DestDir: "{#APP_INCLUDE}\csound"; Flags: ignoreversion;  Components: core
Source: frontends/CsoundAC/*.hpp; DestDir: "{#APP_INCLUDE}\csoundac"; Flags: ignoreversion;  Components: core

Source: {#MyManualSourceDir}html\*.*; DestDir: "{#APP_MANUAL}"; Flags: ignoreversion recursesubdirs;  Components: core

Source: "doc\csound\html\*.*"; DestDir: "{#APP_APIREF}/csound"; Flags: ignoreversion recursesubdirs;  Components: core
Source: "doc\csoundac\html\*.*"; DestDir: "{#APP_APIREF}/csoundac"; Flags: ignoreversion recursesubdirs;  Components: core

Source: "examples\*.*"; DestDir: "{#APP_EXAMPLES}"; Excludes: "*.wav"; Flags: ignoreversion recursesubdirs;  Components: core

Source: "samples\*.*"; DestDir: "{#APP_SAMPLES}"; Flags: ignoreversion recursesubdirs;  Components: core
Source: "{#MyLibStkSourceDir}rawwaves\*.*"; DestDir: "{#APP_SAMPLES}"; Flags: ignoreversion recursesubdirs;  Components: core

Source: {#MyCsoundTutorialSourceDir}tutorial.pdf; DestDir: "{#APP_TUTORIAL}"; Flags: ignoreversion recursesubdirs;  Components: core
Source: {#MyCsoundAcTutorialSourceDir}Csound_Algorithmic_Composition_Tutorial.pdf; DestDir: "{#APP_TUTORIAL}"; Flags: ignoreversion recursesubdirs;  Components: core
Source: {#MyCsoundAcTutorialSourceDir}code\*.*; DestDir: "{#APP_TUTORIAL}code\"; Excludes: "*.wav"; Flags: ignoreversion recursesubdirs;  Components: core

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}";  Components: core;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\Csound"; Filename: "cmd.exe"; Parameters: "/K csound.exe"; WorkingDir: "{#APP_BIN}"; Flags: dontcloseonexit;  Components: core
Name: "{group}\WinSound"; Filename: "{#APP_BIN}winsound.exe"; WorkingDir: "{#APP_BIN}";  Components: core
Name: "{group}\LuaJIT"; Filename: "{#APP_BIN}luajit.exe"; WorkingDir: "{#APP_BIN}";  Components: core
Name: "{group}\Audio device information"; Filename: "cmd"; Parameters: "/K pa_devs.exe"; WorkingDir: "{#APP_BIN}"; Flags: dontcloseonexit;  Components: core
Name: "{group}\Audio device latency"; Filename: "cmd"; Parameters: "/K pa_minlat.exe"; WorkingDir: "{#APP_BIN}"; Flags: dontcloseonexit;  Components: core
Name: "{group}\Csound Reference Manual"; Filename: "{#APP_MANUAL}indexframes.html";  Components: core
Name: "{group}\Csound API Reference Manual"; Filename: "{#APP_APIREF}csound\index.html";  Components: core
Name: "{group}\CsoundAC API Reference Manual"; Filename: "{#APP_APIREF}csoundac\index.html";  Components: core
Name: "{group}\Csound Tutorial"; Filename: "{#APP_TUTORIAL}tutorial.pdf";  Components: core
Name: "{group}\CsoundAC Tutorial"; Filename: "{#APP_TUTORIAL}Csound_Algorithmic_Composition_Tutorial.pdf";  Components: core

[Registry]
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"RAWWAVE_PATH"; ValueData:"{#APP_SAMPLES}"; Flags: preservestringtype uninsdeletekey;  Components: core
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"OPCODE6DIR64"; ValueData:"{#APP_BIN}"; Flags: preservestringtype uninsdeletekey;  Components: core
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"PYTHONPATH"; ValueData:"{#APP_BIN}"; Flags: preservestringtype uninsdeletekey;  Components: python

[Tasks]
Name: modifypath; Description: &Add application directory to your PATH environment variable; Components: core;

[Code]
//	ModPathName defines the name of the task defined above
//	ModPathType defines whether the 'user' or 'system' path will be modified;
//		this will default to user if anything other than system is set
//	setArrayLength must specify the total number of dirs to be added
//	Result[0] contains first directory, Result[1] contains second, etc.
const ModPathName = 'modifypath';
ModPathType = 'system';

function ModPathDir(): TArrayOfString;
begin
	setArrayLength(Result, 1);
	Result[0] := ExpandConstant('{app}/bin');
end;

procedure ModPath();
var
	oldpath:	String;
	newpath:	String;
	updatepath:	Boolean;
	pathArr:	TArrayOfString;
	aExecFile:	String;
	aExecArr:	TArrayOfString;
	i, d:		Integer;
	pathdir:	TArrayOfString;
	regroot:	Integer;
	regpath:	String;
begin
	// Get constants from main script and adjust behavior accordingly
	// ModPathType MUST be 'system' or 'user'; force 'user' if invalid
	if ModPathType = 'system' then begin
		regroot := HKEY_LOCAL_MACHINE;
		regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
	end else begin
		regroot := HKEY_CURRENT_USER;
		regpath := 'Environment';
	end;

	// Get array of new directories and act on each individually
	pathdir := ModPathDir();
	for d := 0 to GetArrayLength(pathdir)-1 do begin
		updatepath := true;

		// Modify WinNT path
		if UsingWinNT() = true then begin

			// Get current path, split into an array
			RegQueryStringValue(regroot, regpath, 'Path', oldpath);
			oldpath := oldpath + ';';
			i := 0;

			while (Pos(';', oldpath) > 0) do begin
				SetArrayLength(pathArr, i+1);
				pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
				oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
				i := i + 1;

				// Check if current directory matches app dir
				if pathdir[d] = pathArr[i-1] then begin
					// if uninstalling, remove dir from path
					if IsUninstaller() = true then begin
						continue;
					// if installing, flag that dir already exists in path
					end else begin
						updatepath := false;
					end;
				end;

				// Add current directory to new path
				if i = 1 then begin
					newpath := pathArr[i-1];
				end else begin
					newpath := newpath + ';' + pathArr[i-1];
				end;
			end;

			// Append app dir to path if not already included
			if (IsUninstaller() = false) AND (updatepath = true) then
				newpath := newpath + ';' + pathdir[d];

			// Write new path
			RegWriteStringValue(regroot, regpath, 'Path', newpath);

		// Modify Win9x path
		end else begin

			// Convert to shortened dirname
			pathdir[d] := GetShortName(pathdir[d]);

			// If autoexec.bat exists, check if app dir already exists in path
			aExecFile := 'C:\AUTOEXEC.BAT';
			if FileExists(aExecFile) then begin
				LoadStringsFromFile(aExecFile, aExecArr);
				for i := 0 to GetArrayLength(aExecArr)-1 do begin
					if IsUninstaller() = false then begin
						// If app dir already exists while installing, skip add
						if (Pos(pathdir[d], aExecArr[i]) > 0) then
							updatepath := false;
							break;
					end else begin
						// If app dir exists and = what we originally set, then delete at uninstall
						if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then
							aExecArr[i] := '';
					end;
				end;
			end;

			// If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path
			if (IsUninstaller() = false) AND (updatepath = true) then begin
				SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True);

			// If uninstalling, write the full autoexec out
			end else begin
				SaveStringsToFile(aExecFile, aExecArr, False);
			end;
		end;
	end;
end;

// Split a string into an array using passed delimeter
procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String);
var
	i: Integer;
begin
	i := 0;
	repeat
		SetArrayLength(Dest, i+1);
		if Pos(Separator,Text) > 0 then	begin
			Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1);
			Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text));
			i := i + 1;
		end else begin
			 Dest[i] := Text;
			 Text := '';
		end;
	until Length(Text)=0;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
	taskname:	String;
begin
	taskname := ModPathName;
	if CurStep = ssPostInstall then
		if IsTaskSelected(taskname) then
			ModPath();
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
	aSelectedTasks:	TArrayOfString;
	i:				Integer;
	taskname:		String;
	regpath:		String;
	regstring:		String;
	appid:			String;
begin
	// only run during actual uninstall
	if CurUninstallStep = usUninstall then begin
		// get list of selected tasks saved in registry at install time
		appid := '{#emit SetupSetting("AppId")}';
		if appid = '' then appid := '{#emit SetupSetting("AppName")}';
		regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1');
		RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring);
		if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring);

		// check each task; if matches modpath taskname, trigger patch removal
		if regstring <> '' then begin
			taskname := ModPathName;
			MPExplode(aSelectedTasks, regstring, ',');
			if GetArrayLength(aSelectedTasks) > 0 then begin
				for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin
					if comparetext(aSelectedTasks[i], taskname) = 0 then
						ModPath();
				end;
			end;
		end;
	end;
end;

function NeedRestart(): Boolean;
var
	taskname:	String;
begin
	taskname := ModPathName;
	if IsTaskSelected(taskname) and not UsingWinNT() then begin
		Result := True;
	end else begin
		Result := False;
	end;
end;

; C S O U N D   6   I N N O   S E T U P   S C R I P T

; Copyright (C) 2013 by Michael Gogins.
; This software is licensed under the terms of the
; Lesser (or Library) GNU Public License.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

; This file assumes that you are Michael Gogins,
; but comments indicate what you should change if you are not me.
; All of these changes SHOULD be in the #defines immediately following this.
; Also, this installer assumes LuaJIT and CsoundAC are part of Csound core.
; At this time the following features are not included in the installer:
; Cabbage, CsoundVST, CsoundQt, the Java API.
; I hope to change this soon.

#define MyAppName "Csound6"
#define MyAppVersion ""
#define MyAppMinVersion "1"
#define MyAppPublisher "Csound"
#define MyAppURL "http://sourceforge.net/projects/csound"
; If you are not Michael Gogins, change this to your MinGW dll directory.
#define MyMinGwBinDir "C:\mingw32-4.7.2\bin\"
; If you are not Michael Gogins, change this to your Csound build directory.
#define MySourceDir "C:\Users\Michael\csound-csound6-git\"
; If you are not Michael Gogins, change this to your Csound reference manual build directory.
#define MyManualSourceDir "C:\Users\Michael\csound-manual6-git\"
; If you are not Michael Gogins, change this to your Csound tutorial directory.
#define MyCsoundTutorialSourceDir "D:\Dropbox\tutorial\"
; If you are not Michael Gogins, change this to your CsoundAC tutorial directory.
#define MyCsoundAcTutorialSourceDir "D:\Dropbox\tutorial\"
; If you are not Michael Gogins, change this to your libsndfile install directory.
#define MyLibSndfileSourceDir "C:\mingw32-4.7.2\msys\1.0\local\lib\libsndfile\"
; If you are not Michael Gogins, change this to your PortAudio lib directory.
#define MyPortAudioSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\portaudio\"
; If you are not Michael Gogins, change this to your PortMidi build directory.
#define MyPortMidiSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\portmidi\"
; If you are not Michael Gogins, change this to your LuaJIT bin directory.
#define MyLuaJitSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\luajit-2.0\src\"
; If you are not Michael Gogins, change this to your FLTK dll directory.
#define MyFltkSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\fltk-1.3.2\src\"
; If you are not Michael Gogins, change this to your libmusicxml dll directory.
#define MyLibMusicXmlSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\libmusicxml-3.00-src\cmake\"
; If you are not Michael Gogins, change this to your FluidSynth dll directory.
#define MyFluidSynthSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\fluidsynth\src\.libs\"
; If you are not Michael Gogins, change this to your OSC library dll directory.
#define MyLibLoSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\liblo-0.26\"
; If you are not Michael Gogins, change this to your STK dll directory.
#define MyLibStkSourceDir "C:\mingw32-4.7.2\msys\1.0\local\src\stk-4.4.4\"

[Components]
Name: "core"; Description: "Core Csound"; Types: full custom; Flags: fixed
Name: "python"; Description: "Python features (requires Python 2.7)"; Types: full;

[Dirs]
; ALL programs and shared libraries (including opcodes and other modules) go here.
Name: "{app}\bin"
#define APP_BIN "{app}\bin\"
; All C or C++ include files for Csound and other components used by Csound go here.
; This is a convenience for people like me who program in C or C++ and might use
; features of these third party components.
Name: "{app}\include"
#define APP_INCLUDE "{app}\include\"
; The Csound reference manual goes here.
Name: "{app}\doc\manual"
#define APP_MANUAL "{app}\doc\manual\"
; The Csound API reference manuals go here.
Name: "{app}\doc\apiref"
#define APP_APIREF "{app}\doc\apiref\"
; All Csound examples go here.
#define APP_EXAMPLES "{app}\examples\"
; Any SoundFonts or sound samples used by Csound examples go here.
Name: "{app}\samples"
#define APP_SAMPLES "{app}\samples\"
; Tutorials go here.
Name: "{app}\doc\tutorial"
#define APP_TUTORIAL "{app}\doc\tutorial\"

; These are the Csound environment variables related to directories.

#define SFDIR
#define SSDIR
#define SADIR
#define INCDIR
#define OPCODE6DIR64
#define SNAPDIR
#define RAWWAVE_PATH
#define MFDIR
#define PYTHONPATH

[Setup]
ChangesEnvironment=true
; 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={{4BCEDC5F-C6D2-4869-9097-3F1753739F35}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppMinVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName=Csound 6
AllowNoIcons=yes
LicenseFile=readme-csound6.txt
;InfoBeforeFile=readme-csound6.txt
OutputDir=installer\windows
OutputBaseFilename=Setup_{#MyAppName}_{#MyAppMinVersion}
Compression=lzma
SolidCompression=yes
SourceDir={#MySourceDir}

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

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "{#MyMinGwBinDir}*.dll"; DestDir: "{#APP_BIN}"; Components: core
Source: "*.exe"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: core
Source: "*.dll"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Excludes: "py.dll"; Components: core
Source: "py.dll"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: python
Source: "*.pyd"; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: python
Source: "*.py";  DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: python

Source: {#MyLibSndfileSourceDir}\bin\*.*; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: core
Source: {#MyLibSndfileSourceDir}\include\*.*; DestDir: "{#APP_INCLUDE}\sndfile"; Flags: ignoreversion; Components: core

Source: {#MyPortAudioSourceDir}lib\.libs\*.dll; DestDir: "{#APP_BIN}"; Components: core
Source: {#MyPortAudioSourceDir}bin\.libs\pa_devs.exe; DestDir: "{#APP_BIN}"; Components: core
Source: {#MyPortAudioSourceDir}bin\.libs\pa_minlat.exe; DestDir: "{#APP_BIN}"; Components: core

Source: {#MyPortMidiSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion; Components: core

Source: {#MyLuaJitSourceDir}luajit.exe; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyLuaJitSourceDir}lua51.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core
Source: {#MyLuaJitSourceDir}lua*.h; DestDir: "{#APP_INCLUDE}\luajit"; Flags: ignoreversion;  Components: core

Source: {#MyFltkSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyLibMusicXmlSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyFluidSynthSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: {#MyLibLoSourceDir}*.dll; DestDir: "{#APP_BIN}"; Flags: ignoreversion;  Components: core

Source: include/*.h*; DestDir: "{#APP_INCLUDE}\csound"; Flags: ignoreversion;  Components: core
Source: frontends/CsoundAC/*.hpp; DestDir: "{#APP_INCLUDE}\csoundac"; Flags: ignoreversion;  Components: core

Source: {#MyManualSourceDir}html\*.*; DestDir: "{#APP_MANUAL}"; Flags: ignoreversion recursesubdirs;  Components: core

Source: "doc\csound\html\*.*"; DestDir: "{#APP_APIREF}/csound"; Flags: ignoreversion recursesubdirs;  Components: core
Source: "doc\csoundac\html\*.*"; DestDir: "{#APP_APIREF}/csoundac"; Flags: ignoreversion recursesubdirs;  Components: core

Source: "examples\*.*"; DestDir: "{#APP_EXAMPLES}"; Excludes: "*.wav"; Flags: ignoreversion recursesubdirs;  Components: core

Source: "samples\*.*"; DestDir: "{#APP_SAMPLES}"; Flags: ignoreversion recursesubdirs;  Components: core
Source: "{#MyLibStkSourceDir}rawwaves\*.*"; DestDir: "{#APP_SAMPLES}"; Flags: ignoreversion recursesubdirs;  Components: core

Source: {#MyCsoundTutorialSourceDir}tutorial.pdf; DestDir: "{#APP_TUTORIAL}"; Flags: ignoreversion recursesubdirs;  Components: core
Source: {#MyCsoundAcTutorialSourceDir}Csound_Algorithmic_Composition_Tutorial.pdf; DestDir: "{#APP_TUTORIAL}"; Flags: ignoreversion recursesubdirs;  Components: core
Source: {#MyCsoundAcTutorialSourceDir}code\*.*; DestDir: "{#APP_TUTORIAL}code\"; Excludes: "*.wav"; Flags: ignoreversion recursesubdirs;  Components: core

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}";  Components: core;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\Csound"; Filename: "cmd.exe"; Parameters: "/K csound.exe"; WorkingDir: "{#APP_BIN}"; Flags: dontcloseonexit;  Components: core
Name: "{group}\WinSound"; Filename: "{#APP_BIN}winsound.exe"; WorkingDir: "{#APP_BIN}";  Components: core
Name: "{group}\LuaJIT"; Filename: "{#APP_BIN}luajit.exe"; WorkingDir: "{#APP_BIN}";  Components: core
Name: "{group}\Audio device information"; Filename: "cmd"; Parameters: "/K pa_devs.exe"; WorkingDir: "{#APP_BIN}"; Flags: dontcloseonexit;  Components: core
Name: "{group}\Audio device latency"; Filename: "cmd"; Parameters: "/K pa_minlat.exe"; WorkingDir: "{#APP_BIN}"; Flags: dontcloseonexit;  Components: core
Name: "{group}\Csound Reference Manual"; Filename: "{#APP_MANUAL}indexframes.html";  Components: core
Name: "{group}\Csound API Reference Manual"; Filename: "{#APP_APIREF}csound\index.html";  Components: core
Name: "{group}\CsoundAC API Reference Manual"; Filename: "{#APP_APIREF}csoundac\index.html";  Components: core
Name: "{group}\Csound Tutorial"; Filename: "{#APP_TUTORIAL}tutorial.pdf";  Components: core
Name: "{group}\CsoundAC Tutorial"; Filename: "{#APP_TUTORIAL}Csound_Algorithmic_Composition_Tutorial.pdf";  Components: core

[Registry]
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"RAWWAVE_PATH"; ValueData:"{#APP_SAMPLES}"; Flags: preservestringtype uninsdeletekey;  Components: core
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"OPCODE6DIR64"; ValueData:"{#APP_BIN}"; Flags: preservestringtype uninsdeletekey;  Components: core
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"PYTHONPATH"; ValueData:"{#APP_BIN}"; Flags: preservestringtype uninsdeletekey;  Components: python

[Tasks]
Name: modifypath; Description: &Add application directory to your PATH environment variable; Components: core;

[Code]
//	ModPathName defines the name of the task defined above
//	ModPathType defines whether the 'user' or 'system' path will be modified;
//		this will default to user if anything other than system is set
//	setArrayLength must specify the total number of dirs to be added
//	Result[0] contains first directory, Result[1] contains second, etc.
const ModPathName = 'modifypath';
ModPathType = 'system';

function ModPathDir(): TArrayOfString;
begin
	setArrayLength(Result, 1);
	Result[0] := ExpandConstant('{app}/bin');
end;

procedure ModPath();
var
	oldpath:	String;
	newpath:	String;
	updatepath:	Boolean;
	pathArr:	TArrayOfString;
	aExecFile:	String;
	aExecArr:	TArrayOfString;
	i, d:		Integer;
	pathdir:	TArrayOfString;
	regroot:	Integer;
	regpath:	String;
begin
	// Get constants from main script and adjust behavior accordingly
	// ModPathType MUST be 'system' or 'user'; force 'user' if invalid
	if ModPathType = 'system' then begin
		regroot := HKEY_LOCAL_MACHINE;
		regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
	end else begin
		regroot := HKEY_CURRENT_USER;
		regpath := 'Environment';
	end;

	// Get array of new directories and act on each individually
	pathdir := ModPathDir();
	for d := 0 to GetArrayLength(pathdir)-1 do begin
		updatepath := true;

		// Modify WinNT path
		if UsingWinNT() = true then begin

			// Get current path, split into an array
			RegQueryStringValue(regroot, regpath, 'Path', oldpath);
			oldpath := oldpath + ';';
			i := 0;

			while (Pos(';', oldpath) > 0) do begin
				SetArrayLength(pathArr, i+1);
				pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
				oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
				i := i + 1;

				// Check if current directory matches app dir
				if pathdir[d] = pathArr[i-1] then begin
					// if uninstalling, remove dir from path
					if IsUninstaller() = true then begin
						continue;
					// if installing, flag that dir already exists in path
					end else begin
						updatepath := false;
					end;
				end;

				// Add current directory to new path
				if i = 1 then begin
					newpath := pathArr[i-1];
				end else begin
					newpath := newpath + ';' + pathArr[i-1];
				end;
			end;

			// Append app dir to path if not already included
			if (IsUninstaller() = false) AND (updatepath = true) then
				newpath := newpath + ';' + pathdir[d];

			// Write new path
			RegWriteStringValue(regroot, regpath, 'Path', newpath);

		// Modify Win9x path
		end else begin

			// Convert to shortened dirname
			pathdir[d] := GetShortName(pathdir[d]);

			// If autoexec.bat exists, check if app dir already exists in path
			aExecFile := 'C:\AUTOEXEC.BAT';
			if FileExists(aExecFile) then begin
				LoadStringsFromFile(aExecFile, aExecArr);
				for i := 0 to GetArrayLength(aExecArr)-1 do begin
					if IsUninstaller() = false then begin
						// If app dir already exists while installing, skip add
						if (Pos(pathdir[d], aExecArr[i]) > 0) then
							updatepath := false;
							break;
					end else begin
						// If app dir exists and = what we originally set, then delete at uninstall
						if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then
							aExecArr[i] := '';
					end;
				end;
			end;

			// If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path
			if (IsUninstaller() = false) AND (updatepath = true) then begin
				SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True);

			// If uninstalling, write the full autoexec out
			end else begin
				SaveStringsToFile(aExecFile, aExecArr, False);
			end;
		end;
	end;
end;

// Split a string into an array using passed delimeter
procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String);
var
	i: Integer;
begin
	i := 0;
	repeat
		SetArrayLength(Dest, i+1);
		if Pos(Separator,Text) > 0 then	begin
			Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1);
			Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text));
			i := i + 1;
		end else begin
			 Dest[i] := Text;
			 Text := '';
		end;
	until Length(Text)=0;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
	taskname:	String;
begin
	taskname := ModPathName;
	if CurStep = ssPostInstall then
		if IsTaskSelected(taskname) then
			ModPath();
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
	aSelectedTasks:	TArrayOfString;
	i:				Integer;
	taskname:		String;
	regpath:		String;
	regstring:		String;
	appid:			String;
begin
	// only run during actual uninstall
	if CurUninstallStep = usUninstall then begin
		// get list of selected tasks saved in registry at install time
		appid := '{#emit SetupSetting("AppId")}';
		if appid = '' then appid := '{#emit SetupSetting("AppName")}';
		regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1');
		RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring);
		if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring);

		// check each task; if matches modpath taskname, trigger patch removal
		if regstring <> '' then begin
			taskname := ModPathName;
			MPExplode(aSelectedTasks, regstring, ',');
			if GetArrayLength(aSelectedTasks) > 0 then begin
				for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin
					if comparetext(aSelectedTasks[i], taskname) = 0 then
						ModPath();
				end;
			end;
		end;
	end;
end;

function NeedRestart(): Boolean;
var
	taskname:	String;
begin
	taskname := ModPathName;
	if IsTaskSelected(taskname) and not UsingWinNT() then begin
		Result := True;
	end else begin
		Result := False;
	end;
end;


installers.windows: Require admin privileges for now

In the future, the installer will only prompt for elevation of
privileges when necessary (installing to system path).

#define PLUGIN_TITLE "Export Layers"
#define INSTALLER_NAME PLUGIN_TITLE + " for GIMP"

[Setup]
AppName={#INSTALLER_NAME}
AppVersion={#PLUGIN_VERSION}
AppVerName={#INSTALLER_NAME} {#PLUGIN_VERSION}
AppPublisher={#AUTHOR_NAME}
DefaultDirName={code:GetPluginsDirpath}
DefaultGroupName=GIMP
DisableProgramGroupPage=Yes
DisableDirPage=Yes
UninstallFilesDir={app}\{#PLUGIN_NAME}
PrivilegesRequired=admin
DirExistsWarning=no
OutputDir={#OUTPUT_DIRPATH}
OutputBaseFilename={#OUTPUT_FILENAME_PREFIX}
WizardSmallImageFile=logo_wizard.bmp
WizardImageFile=menu_path.bmp
SetupIconFile=icon_installer.ico
UninstallDisplayIcon=logo.ico

[Files]
Source: {#INPUT_DIRPATH}\*; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: logo_wizard.bmp; Flags: dontcopy
Source: menu_path.bmp; Flags: dontcopy
Source: icon_installer.ico; Flags: dontcopy
Source: logo.ico; Flags: dontcopy

[Messages]
ReadyLabel2b=Click Install to continue with the installation of {#PLUGIN_TITLE}, or click Customize to modify the installation.
FinishedLabelNoIcons={#PLUGIN_TITLE} successfully installed. To run the plug-in, start GIMP (or restart if already running) and go to File → Export Layers.

[Code]

const
  GIMP_REG_PATH = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GIMP-2_is1';
  GIMP_NOT_FOUND_MESSAGE = (
    'Could not find GIMP installation path.'
    + ' Please specify the path to GIMP and GIMP plug-ins manually.'
    + ' If GIMP is not installed, abort this installation and install GIMP first.');
  PYTHON_NOT_FOUND_IN_GIMP_MESSAGE = (
    'It appears that your GIMP installation does not support Python scripting.'
    + ' Please install GIMP with enabled support for Python scripting before proceeding.');

  MIN_REQUIRED_GIMP_VERSION_MAJOR = 2;
  MIN_REQUIRED_GIMP_VERSION_MINOR = 8;
  MIN_REQUIRED_GIMP_VERSION = '2.8';

  NUM_CUSTOM_PAGES = 2;

type
  TVersionArray = array [0..1] of Integer;

var
  PluginsDirpath: String;
  GimpDirpath: String;
  GimpVersionMajorMinor: TVersionArray;

  CustomPathsPage: TInputDirWizardPage;
  PluginsDirpathEdit: TEdit;
  GimpDirpathEdit: TEdit;

  SelectPluginInstallPathPage: TInputOptionWizardPage;

  IsGimpDetected: Boolean;
  InstallerState: (Initialized, ReadyToInstall);

  CustomizeButton: TNewButton;

procedure AddCustomizeToInstallPage; forward;
procedure OnCustomizeClicked(sender: TObject); forward;
function GetButtonWidthFitToCaption(const caption: String; const xSpacing: Integer) : Integer; forward;

procedure CreateSelectPluginInstallPathPage(const afterID: Integer); forward;
procedure CreateCustomPathsPage(const afterID: Integer); forward;

function ShouldSpecifyCustomPluginsDirpath : Boolean; forward;
procedure CheckPythonScriptingEnabled; forward;

function GetLocalPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String; forward;
function GetSystemPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String; forward;
function GetGimpVersionMajorMinor(const gimpVersion: String) : TVersionArray; forward;
function GetGimpVersionStr(const gimpVersionArray: array of Integer) : String; forward;

function GetPluginsDirpath(value: String) : String;
begin
  Result := PluginsDirpath;
end;

function InitializeSetup() : Boolean;
var
  gimpVersion: String;
begin
  Result := True;

  InstallerState := Initialized;
  IsGimpDetected := True;

  if (not RegQueryStringValue(HKLM64, GIMP_REG_PATH, 'DisplayVersion', gimpVersion)
      and not RegQueryStringValue(HKLM32, GIMP_REG_PATH, 'DisplayVersion', gimpVersion)) then begin
    MsgBox(GIMP_NOT_FOUND_MESSAGE, mbInformation, MB_OK);
    IsGimpDetected := False;
    Exit;
  end;

  GimpVersionMajorMinor := GetGimpVersionMajorMinor(gimpVersion);

  if (GimpVersionMajorMinor[0] <= MIN_REQUIRED_GIMP_VERSION_MAJOR) and (GimpVersionMajorMinor[1] < MIN_REQUIRED_GIMP_VERSION_MINOR) then begin
    MsgBox(
      'GIMP version ' + GetGimpVersionStr(GimpVersionMajorMinor) + ' detected.'
      + ' To use {#PLUGIN_TITLE}, install GIMP ' + MIN_REQUIRED_GIMP_VERSION + ' or later.'
      + ' If you do have GIMP ' + MIN_REQUIRED_GIMP_VERSION + ' or later installed, '
      + 'specify the path to GIMP and GIMP plug-ins manually.'
      + ' Otherwise, abort this installation and install GIMP with a sufficient version first.',
      mbInformation,
      MB_OK);

      IsGimpDetected := False;
      Exit;
  end;

  PluginsDirpath := GetLocalPluginsDirpath(GimpVersionMajorMinor);

  if (not RegQueryStringValue(HKLM64, GIMP_REG_PATH, 'InstallLocation', GimpDirpath)
      and not RegQueryStringValue(HKLM32, GIMP_REG_PATH, 'InstallLocation', GimpDirpath)) then begin
    MsgBox(GIMP_NOT_FOUND_MESSAGE, mbInformation, MB_OK);
    IsGimpDetected := False;
    Exit;
  end
  else begin
    if GimpDirpath[Length(GimpDirpath)] = '\' then begin
      GimpDirpath := Copy(GimpDirpath, 1, Length(GimpDirpath) - 1);
    end;
  end;

  CheckPythonScriptingEnabled();
end;

procedure InitializeWizard;
begin
  AddCustomizeToInstallPage();

  CreateSelectPluginInstallPathPage(wpWelcome);
  CreateCustomPathsPage(SelectPluginInstallPathPage.ID);
end;

function NextButtonClick(curPageID: Integer) : Boolean;
begin
  Result := True;

  if curPageID = CustomPathsPage.ID then begin
    GimpDirpath := GimpDirpathEdit.Text;
    PluginsDirpath := PluginsDirpathEdit.Text;

    CheckPythonScriptingEnabled();
  end
  else if curPageID = SelectPluginInstallPathPage.ID then begin
    if SelectPluginInstallPathPage.values[0] then begin
      PluginsDirpath := GetLocalPluginsDirpath(GimpVersionMajorMinor);
    end
    else if SelectPluginInstallPathPage.values[1] then begin
      PluginsDirpath := GetSystemPluginsDirpath(GimpVersionMajorMinor);
    end;

    PluginsDirpathEdit.Text := PluginsDirpath;
  end;
end;

function ShouldSkipPage(pageID: Integer) : Boolean;
var
  isInstallerStarted: Boolean;
  isInstallerStartedWithGimpNotDetected: Boolean;
  shouldSkipCustomPathsPage: Boolean;
begin
  isInstallerStarted := (
    (pageID <> wpReady)
    and (InstallerState = Initialized)
    and IsGimpDetected);

  isInstallerStartedWithGimpNotDetected := (
    (pageID = SelectPluginInstallPathPage.ID)
    and (InstallerState = Initialized)
    and not IsGimpDetected);

  shouldSkipCustomPathsPage := (
    (pageID = CustomPathsPage.ID)
    and (InstallerState <> Initialized)
    and not ShouldSpecifyCustomPluginsDirpath());

  Result := (
    isInstallerStarted
    or isInstallerStartedWithGimpNotDetected
    or shouldSkipCustomPathsPage);
end;

procedure CurPageChanged(curPageID: Integer);
begin
  CustomizeButton.visible := (curPageID = wpReady) and IsGimpDetected;

  if (curPageID = CustomPathsPage.ID) and not IsGimpDetected then begin
    WizardForm.BackButton.visible := False;
  end;

  if curPageID = wpReady then begin
    InstallerState := ReadyToInstall;

    // Assign correct value to `DefaultDirName` (it may be empty or incorrect at this point).
    WizardForm.DirEdit.Text := PluginsDirpath;
  end;
end;

procedure AddCustomizeToInstallPage;
begin
  CustomizeButton := TNewButton.Create(WizardForm);

  with CustomizeButton do begin
    Caption := 'Customize';
    Parent := WizardForm;
    Width := GetButtonWidthFitToCaption(Caption, 12);
    Height := WizardForm.NextButton.Height;
    Left := WizardForm.ClientWidth - (WizardForm.CancelButton.Left + WizardForm.CancelButton.Width);
    Top := WizardForm.NextButton.Top;

    OnClick := @OnCustomizeClicked;
  end;
end;

procedure OnCustomizeClicked(sender: TObject);
var
  i: Integer;
begin
  for i := 0 to NUM_CUSTOM_PAGES - 1 do begin
    WizardForm.BackButton.OnClick(TNewButton(sender).Parent);
  end;
end;

function GetButtonWidthFitToCaption(const caption: String; const xSpacing: Integer) : Integer;
var
  dummyLabel: TNewStaticText;
  defaultWidth: Integer;
begin
  dummyLabel := TNewStaticText.Create(WizardForm);

  dummyLabel.Autosize := True;
  dummyLabel.Caption := caption;

  defaultWidth := WizardForm.NextButton.Width;

  if defaultWidth >= dummyLabel.Width + ScaleX(xSpacing) then begin
    Result := defaultWidth;
  end
  else begin
    Result := dummyLabel.Width + ScaleX(xSpacing);
  end;

  dummyLabel.Free;
end;

procedure CreateSelectPluginInstallPathPage(const afterID: Integer);
begin
  SelectPluginInstallPathPage := CreateInputOptionPage(
    afterID,
    'Select Installation Path',
    'Where should {#PLUGIN_TITLE} be installed?',
    'Select one of the options below:',
    True,
    False
  );

  SelectPluginInstallPathPage.Add('Install for just me');
  SelectPluginInstallPathPage.Add(
    'Install for all users');
  SelectPluginInstallPathPage.Add('Choose custom installation path');

  SelectPluginInstallPathPage.Values[0] := True;
end;

procedure CreateCustomPathsPage(const afterID: Integer);
var
  lastAddedDirIndex: Integer;
begin
  CustomPathsPage := CreateInputDirPage(
    afterID,
    'Select Location for GIMP and GIMP Plug-ins',
    'Where is GIMP located and where should {#PLUGIN_TITLE} be installed?',
    'Specify custom directory path to a working GIMP installation and to GIMP plug-ins.',
    False,
    'New Folder');

  lastAddedDirIndex := CustomPathsPage.Add('Path to GIMP installation');
  GimpDirpathEdit := CustomPathsPage.Edits[lastAddedDirIndex];
  CustomPathsPage.Values[0] := GimpDirpath;

  lastAddedDirIndex := CustomPathsPage.Add('Path to GIMP plug-ins');
  PluginsDirpathEdit := CustomPathsPage.Edits[lastAddedDirIndex];
  CustomPathsPage.Values[1] := PluginsDirpath;
end;

function ShouldSpecifyCustomPluginsDirpath : Boolean;
begin
  Result := SelectPluginInstallPathPage.values[2];
end;

procedure CheckPythonScriptingEnabled;
var
  possiblePythonDirpaths: TStringList;
  i: Integer;
  pythonPathFound: Boolean;
begin
  pythonPathFound := False;

  possiblePythonDirpaths := TStringList.Create;
  possiblePythonDirpaths.Add(GimpDirpath + '\Python');
  possiblePythonDirpaths.Add(GimpDirpath + '\32\lib\python2.7');
  possiblePythonDirpaths.Add(GimpDirpath + '\lib\python2.7');

  for i := 0 to possiblePythonDirpaths.Count - 1 do begin
    if DirExists(possiblePythonDirpaths[i]) then begin
      pythonPathFound := True;
      break;
    end;
  end;

  possiblePythonDirpaths.Free;

  if not pythonPathFound then begin
    MsgBox(PYTHON_NOT_FOUND_IN_GIMP_MESSAGE, mbInformation, MB_OK);
    Abort();
  end;
end;

function GetLocalPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String;
var
  gimpVersionMajorMinorStr: String;
begin
  gimpVersionMajorMinorStr := GetGimpVersionStr(gimpVersionMajorMinor);

  if (gimpVersionMajorMinor[0] <= 2) and (gimpVersionMajorMinor[1] < 9) then begin
    Result := ExpandConstant('{%USERPROFILE}') + '\.gimp-' + gimpVersionMajorMinorStr + '\plug-ins';
  end
  else begin
    Result := ExpandConstant('{userappdata}') + '\GIMP\' + gimpVersionMajorMinorStr + '\plug-ins';
  end;
end;

function GetSystemPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String;
begin
  Result := GimpDirpath + '\lib\gimp\' + IntToStr(gimpVersionMajorMinor[0]) + '.0\plug-ins';
end;

function GetGimpVersionMajorMinor(const gimpVersion: String) : TVersionArray;
var
  versionNumberMajorMinor: TVersionArray;
  i: Integer;
  versionNumberFields: array of Integer;
  versionNumberFieldCurrentArrayIndex: Integer;
  versionNumberFieldStartIndex: Integer;
begin
  versionNumberFieldCurrentArrayIndex := 0;
  versionNumberFieldStartIndex := 1;

  for i := 1 to Length(gimpVersion) do begin
    if gimpVersion[i] = '.' then begin
      SetArrayLength(versionNumberFields, GetArrayLength(versionNumberFields) + 1);
      versionNumberFields[versionNumberFieldCurrentArrayIndex] := (
        StrToIntDef(
          Copy(
            gimpVersion, versionNumberFieldStartIndex, i - versionNumberFieldStartIndex), -1));
      versionNumberFieldCurrentArrayIndex := versionNumberFieldCurrentArrayIndex + 1;
      versionNumberFieldStartIndex := i + 1;
    end;
  end;

  if versionNumberFieldStartIndex <= Length(gimpVersion) then begin
    SetArrayLength(versionNumberFields, GetArrayLength(versionNumberFields) + 1);
    versionNumberFields[versionNumberFieldCurrentArrayIndex] := (
      StrToIntDef(
        Copy(
          gimpVersion, versionNumberFieldStartIndex, Length(gimpVersion) + 1 - versionNumberFieldStartIndex), -1));
  end;

  versionNumberMajorMinor[0] := versionNumberFields[0];
  versionNumberMajorMinor[1] := versionNumberFields[1];

  Result := versionNumberMajorMinor;
end;

function GetGimpVersionStr(const gimpVersionArray: array of Integer) : String;
var
  i: Integer;
  gimpVersionStr: String;
begin
  gimpVersionStr := '';

  for i := 0 to Length(gimpVersionArray) - 1 do begin
    gimpVersionStr := gimpVersionStr + IntToStr(gimpVersionArray[i]) + '.';
  end;

  Result := Copy(gimpVersionStr, 1, Length(gimpVersionStr) - 1);
end;

#define PLUGIN_TITLE "Export Layers"
#define INSTALLER_NAME PLUGIN_TITLE + " for GIMP"

[Setup]
AppName={#INSTALLER_NAME}
AppVersion={#PLUGIN_VERSION}
AppVerName={#INSTALLER_NAME} {#PLUGIN_VERSION}
AppPublisher={#AUTHOR_NAME}
DefaultDirName={code:GetPluginsDirpath}
DefaultGroupName=GIMP
DisableProgramGroupPage=Yes
DisableDirPage=Yes
UninstallFilesDir={app}\{#PLUGIN_NAME}
PrivilegesRequired=lowest
DirExistsWarning=no
OutputDir={#OUTPUT_DIRPATH}
OutputBaseFilename={#OUTPUT_FILENAME_PREFIX}
WizardSmallImageFile=logo_wizard.bmp
WizardImageFile=menu_path.bmp
SetupIconFile=icon_installer.ico
UninstallDisplayIcon=logo.ico

[Files]
Source: {#INPUT_DIRPATH}\*; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: logo_wizard.bmp; Flags: dontcopy
Source: menu_path.bmp; Flags: dontcopy
Source: icon_installer.ico; Flags: dontcopy
Source: logo.ico; Flags: dontcopy

[Messages]
ReadyLabel2b=Click Install to continue with the installation of {#PLUGIN_TITLE}, or click Customize to modify the installation.
FinishedLabelNoIcons={#PLUGIN_TITLE} successfully installed. To run the plug-in, start GIMP (or restart if already running) and go to File → Export Layers.

[Code]

const
  GIMP_REG_PATH = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GIMP-2_is1';
  GIMP_NOT_FOUND_MESSAGE = (
    'Could not find GIMP installation path.'
    + ' Please specify the path to GIMP and GIMP plug-ins manually.'
    + ' If GIMP is not installed, abort this installation and install GIMP first.');
  PYTHON_NOT_FOUND_IN_GIMP_MESSAGE = (
    'It appears that your GIMP installation does not support Python scripting.'
    + ' Please install GIMP with enabled support for Python scripting before proceeding.');

  MIN_REQUIRED_GIMP_VERSION_MAJOR = 2;
  MIN_REQUIRED_GIMP_VERSION_MINOR = 8;
  MIN_REQUIRED_GIMP_VERSION = '2.8';

  NUM_CUSTOM_PAGES = 2;

type
  TVersionArray = array [0..1] of Integer;

var
  PluginsDirpath: String;
  GimpDirpath: String;
  GimpVersionMajorMinor: TVersionArray;

  CustomPathsPage: TInputDirWizardPage;
  PluginsDirpathEdit: TEdit;
  GimpDirpathEdit: TEdit;

  SelectPluginInstallPathPage: TInputOptionWizardPage;

  IsGimpDetected: Boolean;
  InstallerState: (Initialized, ReadyToInstall);

  CustomizeButton: TNewButton;

procedure AddCustomizeToInstallPage; forward;
procedure OnCustomizeClicked(sender: TObject); forward;
function GetButtonWidthFitToCaption(const caption: String; const xSpacing: Integer) : Integer; forward;

procedure CreateSelectPluginInstallPathPage(const afterID: Integer); forward;
procedure CreateCustomPathsPage(const afterID: Integer); forward;

function ShouldSpecifyCustomPluginsDirpath : Boolean; forward;
procedure CheckPythonScriptingEnabled; forward;

function GetLocalPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String; forward;
function GetSystemPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String; forward;
function GetGimpVersionMajorMinor(const gimpVersion: String) : TVersionArray; forward;
function GetGimpVersionStr(const gimpVersionArray: array of Integer) : String; forward;

function GetPluginsDirpath(value: String) : String;
begin
  Result := PluginsDirpath;
end;

function InitializeSetup() : Boolean;
var
  gimpVersion: String;
begin
  Result := True;

  InstallerState := Initialized;
  IsGimpDetected := True;

  if (not RegQueryStringValue(HKLM64, GIMP_REG_PATH, 'DisplayVersion', gimpVersion)
      and not RegQueryStringValue(HKLM32, GIMP_REG_PATH, 'DisplayVersion', gimpVersion)) then begin
    MsgBox(GIMP_NOT_FOUND_MESSAGE, mbInformation, MB_OK);
    IsGimpDetected := False;
    Exit;
  end;

  GimpVersionMajorMinor := GetGimpVersionMajorMinor(gimpVersion);

  if (GimpVersionMajorMinor[0] <= MIN_REQUIRED_GIMP_VERSION_MAJOR) and (GimpVersionMajorMinor[1] < MIN_REQUIRED_GIMP_VERSION_MINOR) then begin
    MsgBox(
      'GIMP version ' + GetGimpVersionStr(GimpVersionMajorMinor) + ' detected.'
      + ' To use {#PLUGIN_TITLE}, install GIMP ' + MIN_REQUIRED_GIMP_VERSION + ' or later.'
      + ' If you do have GIMP ' + MIN_REQUIRED_GIMP_VERSION + ' or later installed, '
      + 'specify the path to GIMP and GIMP plug-ins manually.'
      + ' Otherwise, abort this installation and install GIMP with a sufficient version first.',
      mbInformation,
      MB_OK);

      IsGimpDetected := False;
      Exit;
  end;

  PluginsDirpath := GetLocalPluginsDirpath(GimpVersionMajorMinor);

  if (not RegQueryStringValue(HKLM64, GIMP_REG_PATH, 'InstallLocation', GimpDirpath)
      and not RegQueryStringValue(HKLM32, GIMP_REG_PATH, 'InstallLocation', GimpDirpath)) then begin
    MsgBox(GIMP_NOT_FOUND_MESSAGE, mbInformation, MB_OK);
    IsGimpDetected := False;
    Exit;
  end
  else begin
    if GimpDirpath[Length(GimpDirpath)] = '\' then begin
      GimpDirpath := Copy(GimpDirpath, 1, Length(GimpDirpath) - 1);
    end;
  end;

  CheckPythonScriptingEnabled();
end;

procedure InitializeWizard;
begin
  AddCustomizeToInstallPage();

  CreateSelectPluginInstallPathPage(wpWelcome);
  CreateCustomPathsPage(SelectPluginInstallPathPage.ID);
end;

function NextButtonClick(curPageID: Integer) : Boolean;
begin
  Result := True;

  if curPageID = CustomPathsPage.ID then begin
    GimpDirpath := GimpDirpathEdit.Text;
    PluginsDirpath := PluginsDirpathEdit.Text;

    CheckPythonScriptingEnabled();
  end
  else if curPageID = SelectPluginInstallPathPage.ID then begin
    if SelectPluginInstallPathPage.values[0] then begin
      PluginsDirpath := GetLocalPluginsDirpath(GimpVersionMajorMinor);
    end
    else if SelectPluginInstallPathPage.values[1] then begin
      PluginsDirpath := GetSystemPluginsDirpath(GimpVersionMajorMinor);
    end;

    PluginsDirpathEdit.Text := PluginsDirpath;
  end;
end;

function ShouldSkipPage(pageID: Integer) : Boolean;
var
  isInstallerStarted: Boolean;
  isInstallerStartedWithGimpNotDetected: Boolean;
  shouldSkipCustomPathsPage: Boolean;
begin
  isInstallerStarted := (
    (pageID <> wpReady)
    and (InstallerState = Initialized)
    and IsGimpDetected);

  isInstallerStartedWithGimpNotDetected := (
    (pageID = SelectPluginInstallPathPage.ID)
    and (InstallerState = Initialized)
    and not IsGimpDetected);

  shouldSkipCustomPathsPage := (
    (pageID = CustomPathsPage.ID)
    and (InstallerState <> Initialized)
    and not ShouldSpecifyCustomPluginsDirpath());

  Result := (
    isInstallerStarted
    or isInstallerStartedWithGimpNotDetected
    or shouldSkipCustomPathsPage);
end;

procedure CurPageChanged(curPageID: Integer);
begin
  CustomizeButton.visible := (curPageID = wpReady) and IsGimpDetected;

  if (curPageID = CustomPathsPage.ID) and not IsGimpDetected then begin
    WizardForm.BackButton.visible := False;
  end;

  if curPageID = wpReady then begin
    InstallerState := ReadyToInstall;

    // Assign correct value to `DefaultDirName` (it may be empty or incorrect at this point).
    WizardForm.DirEdit.Text := PluginsDirpath;
  end;
end;

procedure AddCustomizeToInstallPage;
begin
  CustomizeButton := TNewButton.Create(WizardForm);

  with CustomizeButton do begin
    Caption := 'Customize';
    Parent := WizardForm;
    Width := GetButtonWidthFitToCaption(Caption, 12);
    Height := WizardForm.NextButton.Height;
    Left := WizardForm.ClientWidth - (WizardForm.CancelButton.Left + WizardForm.CancelButton.Width);
    Top := WizardForm.NextButton.Top;

    OnClick := @OnCustomizeClicked;
  end;
end;

procedure OnCustomizeClicked(sender: TObject);
var
  i: Integer;
begin
  for i := 0 to NUM_CUSTOM_PAGES - 1 do begin
    WizardForm.BackButton.OnClick(TNewButton(sender).Parent);
  end;
end;

function GetButtonWidthFitToCaption(const caption: String; const xSpacing: Integer) : Integer;
var
  dummyLabel: TNewStaticText;
  defaultWidth: Integer;
begin
  dummyLabel := TNewStaticText.Create(WizardForm);

  dummyLabel.Autosize := True;
  dummyLabel.Caption := caption;

  defaultWidth := WizardForm.NextButton.Width;

  if defaultWidth >= dummyLabel.Width + ScaleX(xSpacing) then begin
    Result := defaultWidth;
  end
  else begin
    Result := dummyLabel.Width + ScaleX(xSpacing);
  end;

  dummyLabel.Free;
end;

procedure CreateSelectPluginInstallPathPage(const afterID: Integer);
begin
  SelectPluginInstallPathPage := CreateInputOptionPage(
    afterID,
    'Select Installation Path',
    'Where should {#PLUGIN_TITLE} be installed?',
    'Select one of the options below:',
    True,
    False
  );

  SelectPluginInstallPathPage.Add('Install for just me');
  SelectPluginInstallPathPage.Add(
    'Install for all users (requires administrator privileges)');
  SelectPluginInstallPathPage.Add('Choose custom installation path');

  SelectPluginInstallPathPage.Values[0] := True;
end;

procedure CreateCustomPathsPage(const afterID: Integer);
var
  lastAddedDirIndex: Integer;
begin
  CustomPathsPage := CreateInputDirPage(
    afterID,
    'Select Location for GIMP and GIMP Plug-ins',
    'Where is GIMP located and where should {#PLUGIN_TITLE} be installed?',
    'Specify custom directory path to a working GIMP installation and to GIMP plug-ins.',
    False,
    'New Folder');

  lastAddedDirIndex := CustomPathsPage.Add('Path to GIMP installation');
  GimpDirpathEdit := CustomPathsPage.Edits[lastAddedDirIndex];
  CustomPathsPage.Values[0] := GimpDirpath;

  lastAddedDirIndex := CustomPathsPage.Add('Path to GIMP plug-ins');
  PluginsDirpathEdit := CustomPathsPage.Edits[lastAddedDirIndex];
  CustomPathsPage.Values[1] := PluginsDirpath;
end;

function ShouldSpecifyCustomPluginsDirpath : Boolean;
begin
  Result := SelectPluginInstallPathPage.values[2];
end;

procedure CheckPythonScriptingEnabled;
var
  possiblePythonDirpaths: TStringList;
  i: Integer;
  pythonPathFound: Boolean;
begin
  pythonPathFound := False;

  possiblePythonDirpaths := TStringList.Create;
  possiblePythonDirpaths.Add(GimpDirpath + '\Python');
  possiblePythonDirpaths.Add(GimpDirpath + '\32\lib\python2.7');
  possiblePythonDirpaths.Add(GimpDirpath + '\lib\python2.7');

  for i := 0 to possiblePythonDirpaths.Count - 1 do begin
    if DirExists(possiblePythonDirpaths[i]) then begin
      pythonPathFound := True;
      break;
    end;
  end;

  possiblePythonDirpaths.Free;

  if not pythonPathFound then begin
    MsgBox(PYTHON_NOT_FOUND_IN_GIMP_MESSAGE, mbInformation, MB_OK);
    Abort();
  end;
end;

function GetLocalPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String;
var
  gimpVersionMajorMinorStr: String;
begin
  gimpVersionMajorMinorStr := GetGimpVersionStr(gimpVersionMajorMinor);

  if (gimpVersionMajorMinor[0] <= 2) and (gimpVersionMajorMinor[1] < 9) then begin
    Result := ExpandConstant('{%USERPROFILE}') + '\.gimp-' + gimpVersionMajorMinorStr + '\plug-ins';
  end
  else begin
    Result := ExpandConstant('{userappdata}') + '\GIMP\' + gimpVersionMajorMinorStr + '\plug-ins';
  end;
end;

function GetSystemPluginsDirpath(const gimpVersionMajorMinor: TVersionArray) : String;
begin
  Result := GimpDirpath + '\lib\gimp\' + IntToStr(gimpVersionMajorMinor[0]) + '.0\plug-ins';
end;

function GetGimpVersionMajorMinor(const gimpVersion: String) : TVersionArray;
var
  versionNumberMajorMinor: TVersionArray;
  i: Integer;
  versionNumberFields: array of Integer;
  versionNumberFieldCurrentArrayIndex: Integer;
  versionNumberFieldStartIndex: Integer;
begin
  versionNumberFieldCurrentArrayIndex := 0;
  versionNumberFieldStartIndex := 1;

  for i := 1 to Length(gimpVersion) do begin
    if gimpVersion[i] = '.' then begin
      SetArrayLength(versionNumberFields, GetArrayLength(versionNumberFields) + 1);
      versionNumberFields[versionNumberFieldCurrentArrayIndex] := (
        StrToIntDef(
          Copy(
            gimpVersion, versionNumberFieldStartIndex, i - versionNumberFieldStartIndex), -1));
      versionNumberFieldCurrentArrayIndex := versionNumberFieldCurrentArrayIndex + 1;
      versionNumberFieldStartIndex := i + 1;
    end;
  end;

  if versionNumberFieldStartIndex <= Length(gimpVersion) then begin
    SetArrayLength(versionNumberFields, GetArrayLength(versionNumberFields) + 1);
    versionNumberFields[versionNumberFieldCurrentArrayIndex] := (
      StrToIntDef(
        Copy(
          gimpVersion, versionNumberFieldStartIndex, Length(gimpVersion) + 1 - versionNumberFieldStartIndex), -1));
  end;

  versionNumberMajorMinor[0] := versionNumberFields[0];
  versionNumberMajorMinor[1] := versionNumberFields[1];

  Result := versionNumberMajorMinor;
end;

function GetGimpVersionStr(const gimpVersionArray: array of Integer) : String;
var
  i: Integer;
  gimpVersionStr: String;
begin
  gimpVersionStr := '';

  for i := 0 to Length(gimpVersionArray) - 1 do begin
    gimpVersionStr := gimpVersionStr + IntToStr(gimpVersionArray[i]) + '.';
  end;

  Result := Copy(gimpVersionStr, 1, Length(gimpVersionStr) - 1);
end;


Leave the Inno script in better shape.  Added registration of .py etc extensions -- but Inno uninstall doesn't restore previous ones (if any), so that's another step backwards.

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

; This is the whole ball of wax for an Inno installer for Python.
; To use, download Inno Setup from http://www.jrsoftware.org/isdl.htm/,
; install it, and double-click on this file.  That launches the Inno
; script compiler.  The GUI is extemely simple, and has only one button
; you may not recognize instantly:  click it.  You're done.  It builds
; the installer into PCBuild/Python-2.2a1.exe.  Size and speed of the
; installer are competitive with the Wise installer; Inno uninstall
; seems much quicker than Wise (but also feebler, and the uninstall
; log is in some un(human)readable binary format).
;
; What's Done
; -----------
; All the usual Windows Python files are installed by this now.
; All the usual Windows Python Start menu entries are created and
; work fine.
; .py, .pyw, .pyc and .pyo extensions are registered.
;     PROBLEM:  Inno uninstall does not restore their previous registry
;               associations (if any).  Wise did.  This will make life
;               difficult for alpha (etc) testers.
; The Python install is fully functional for "typical" uses.
;
; What's Not Done
; ---------------
; None of "Mark Hammond's" registry entries are written.
; No installation of files is done into the system dir:
;     The MS DLLs aren't handled at all by this yet.
;     Python22.dll is unpacked into the main Python dir.
;
; Inno can't do different things on NT/2000 depending on whether the user
; has Admin privileges, so I don't know how to "solve" either of those,
; short of building two installers (one *requiring* Admin privs, the
; other not doing anything that needs Admin privs).
;
; Inno has no concept of variables, so lots of lines in this file need
; to be fiddled by hand across releases.  Simplest way out:  stick this
; file in a giant triple-quoted r-string (note that backslashes are
; required all over the place here -- forward slashes DON'T WORK in
; Inno), and use %(yadda)s string interpolation to do substitutions; i.e.,
; write a very simple Python program to *produce* this script.

[Setup]
; Note:  we *want* the version number to show up everywhere.
; Which of these controls App Path???
AppName=Python 2.2 alpha 1
AppVerName=Python 2.2 alpha 1
AppId=Python 2.2
AppVersion=2.2a1
AppCopyright=Copyright  2001 Python Software Foundation

; Default install dir; value of {app} later (unless user overrides).
; {sd} = system root drive, probably "C:".
DefaultDirName={sd}\Python22

; Start menu folder name; value of {group} later (unless user overrides).
DefaultGroupName=Python 2.2

; Point SourceDir to one above PCBuild = src.
; YAY!  That actually worked:  means this script can run unchanged from anyone's
; CVS tree, no matter what they called the top-level directories.  Wise
; required hardcoded absolute paths all over the place.
SourceDir=..
OutputDir=PCBuild
OutputBaseFilename=Python-2.2a1

AppPublisher=PythonLabs at Digital Creations
AppPublisherURL=http://www.python.org
AppSupportURL=http://www.python.org
AppUpdatesURL=http://www.python.org

AlwaysCreateUninstallIcon=yes
ChangesAssociations=yes
UninstallLogMode=new

; The fewer screens the better; leave these commented.
;LicenseFile=LICENSE
;InfoBeforeFile=Misc\NEWS

; uncomment the following line if you want your installation to run on NT 3.51 too.
; MinVersion=4,3.51

[Types]
Name: normal; Description: "Select desired components"; Flags: iscustom

[Components]
Name: main;  Description: "Python interpreter, library and Tk"; Types: normal
Name: docs;  Description: "Python documentation (HTML)";        Types: normal
Name: tools; Description: "Python utility scripts (Tools\)";    Types: normal
Name: test;  Description: "Python test suite (Lib\test\)";      Types: normal

[Tasks]
Name: startmenu; Description: "Create Start menu shortcuts"; Components: main docs tools
Name: extensions; Description: "Register file extensions (.py, .pyw, .pyc, .pyo)"; Components: main

[Files]
; Caution:  Using forward slashes instead screws up in amazing ways.
; Unknown:  By the time Components (and other attrs) are added to these lines, they're
; going to get awfully long.  But don't see a way to continue logical lines across
; physical lines.

Source: LICENSE;   DestDir: "{app}"; DestName: LICENSE.txt; CopyMode: alwaysoverwrite
Source: README;    DestDir: "{app}"; DestName: README.txt;  CopyMode: alwaysoverwrite
Source: Misc\News; DestDir: "{app}"; DestName: NEWS.txt;    CopyMode: alwaysoverwrite
Source: PC\*.ico;  DestDir: "{app}";                        CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\python.exe;   DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\pythonw.exe;  DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\w9xpopen.exe; DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\python22.dll; DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main

Source: ..\tcl\bin\tcl83.dll; DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: ..\tcl\bin\tk83.dll;  DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: ..\tcl\lib\*.*;       DestDir: "{app}\tcl";  CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs

Source: PCbuild\_socket.pyd;     DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_socket.lib;     DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_sre.pyd;        DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_sre.lib;        DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_symtable.pyd;   DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_symtable.lib;   DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_testcapi.pyd;   DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_testcapi.lib;   DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_tkinter.pyd;    DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_tkinter.lib;    DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\bsddb.pyd;       DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\bsddb.lib;       DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\mmap.pyd;        DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\mmap.lib;        DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\parser.pyd;      DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\parser.lib;      DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\pyexpat.pyd;     DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\pyexpat.lib;     DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\select.pyd;      DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\select.lib;      DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\unicodedata.pyd; DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\unicodedata.lib; DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_winreg.pyd;     DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_winreg.lib;     DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\winsound.pyd;    DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\winsound.lib;    DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\zlib.pyd;        DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\zlib.lib;        DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\python22.lib;    DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: ..\expat\bin\xmlparse.dll; DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: ..\expat\bin\xmltok.dll;   DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main

Source: Lib\*.py; DestDir: "{app}\Lib"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\lib-tk\*.py; DestDir: "{app}\Lib\lib-tk"; CopyMode: alwaysoverwrite; Components: main

Source: Lib\encodings\*.py; DestDir: "{app}\Lib\encodings"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\distutils\*.py; DestDir: "{app}\Lib\distutils"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\xml\*.py; DestDir: "{app}\Lib\xml"; CopyMode: alwaysoverwrite; Flags: recursesubdirs; Components: main
Source: Lib\lib-old\*.py;  DestDir: "{app}\Lib\lib-old"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\site-packages\README; DestDir: "{app}\Lib\site-packages"; DestName: README.txt; CopyMode: alwaysoverwrite; Components: main
Source: Include\*.h; DestDir: "{app}\include"; CopyMode: alwaysoverwrite; Components: main
Source: PC\config.h; DestDir: "{app}\include"; CopyMode: alwaysoverwrite; Components: main

Source: Tools\scripts\*.py;  DestDir: "{app}\Tools\Scripts";  CopyMode: alwaysoverwrite; Components: tools
Source: Tools\scripts\*.pyw; DestDir: "{app}\Tools\Scripts";  CopyMode: alwaysoverwrite; Components: tools
Source: Tools\scripts\*.doc; DestDir: "{app}\Tools\Scripts";  CopyMode: alwaysoverwrite; Components: tools
Source: Tools\scripts\README; DestDir: "{app}\Tools\Scripts"; DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools

Source: Tools\webchecker\*.py;   DestDir: "{app}\Tools\webchecker"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\webchecker\README; DestDir: "{app}\Tools\webchecker"; DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools

Source: Tools\versioncheck\*.py;   DestDir: "{app}\Tools\versioncheck"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\versioncheck\README; DestDir: "{app}\Tools\versioncheck"; DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools

Source: Tools\idle\*.py;      DestDir: "{app}\Tools\idle";       CopyMode: alwaysoverwrite; Components: tools
Source: Tools\idle\idle.pyw;  DestDir: "{app}\Tools\idle";       CopyMode: alwaysoverwrite; Components: tools
Source: Tools\idle\*.txt;     DestDir: "{app}\Tools\idle";       CopyMode: alwaysoverwrite; Components: tools
Source: Tools\idle\Icons\*.*; DestDir: "{app}\Tools\idle\Icons"; CopyMode: alwaysoverwrite; Components: tools

Source: Tools\compiler\*.py;           DestDir: "{app}\Tools\compiler";          CopyMode: alwaysoverwrite; Components: tools
Source: Tools\compiler\compiler\*.py;  DestDir: "{app}\Tools\compiler\compiler"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\compiler\compiler\*.txt; DestDir: "{app}\Tools\compiler\compiler"; CopyMode: alwaysoverwrite; Components: tools

Source: Tools\pynche\*.py;       DestDir: "{app}\Tools\pynche";   CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\pynche.pyw; DestDir: "{app}\Tools\pynche";   CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\X\*.txt;    DestDir: "{app}\Tools\pynche\X"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\README;     DestDir: "{app}\Tools\pynche";   DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\pynche;     DestDir: "{app}\Tools\pynche";   DestName: pynche.py;       CopyMode: alwaysoverwrite; Components: tools

Source: html\*.*; DestDir: "{app}\Doc"; CopyMode: alwaysoverwrite; Flags: recursesubdirs; Components: docs

Source: Lib\test\*.py;         DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\*.uue;        DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\*.xml;        DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\*.out;        DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\audiotest.au; DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\output\*.*;   DestDir: "{app}\Lib\test\output"; CopyMode: alwaysoverwrite; Components: test

[Icons]
Tasks: startmenu; Name: "{group}\IDLE (Python GUI)"; Filename: "{app}\pythonw.exe"; WorkingDir: "{app}"; Parameters: """{app}\Tools\idle\idle.pyw"""; Components: tools
Tasks: startmenu; Name: "{group}\Module Docs"; Filename: "{app}\pythonw.exe"; WorkingDir: "{app}"; Parameters: """{app}\Tools\Scripts\pydoc.pyw"""; Components: tools
Tasks: startmenu; Name: "{group}\Python (command line)"; Filename: "{app}\python.exe"; WorkingDir: "{app}"; Components: main
Tasks: startmenu; Name: "{group}\Python Manuals"; Filename: "{app}\Doc\index.html"; WorkingDir: "{app}"; Components: docs

[Registry]
; Register .py
Tasks: extensions; Root: HKCR; Subkey: ".py"; ValueType: string; ValueName: ""; ValueData: "Python File"; Flags: uninsdeletevalue
Tasks: extensions; Root: HKCR; Subkey: ".py"; ValueType: string; ValueName: "Content Type"; ValueData: "text/plain"; Flags: uninsdeletevalue
Tasks: extensions; Root: HKCR; Subkey: "Python File"; ValueType: string; ValueName: ""; ValueData: "Python File"; Flags: uninsdeletekey
Tasks: extensions; Root: HKCR; Subkey: "Python File\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Py.ico"
Tasks: extensions; Root: HKCR; Subkey: "Python File\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\python.exe"" ""%1"" %*"

; Register .pyc
Tasks: extensions; Root: HKCR; Subkey: ".pyc"; ValueType: string; ValueName: ""; ValueData: "Python CompiledFile"; Flags: uninsdeletevalue
Tasks: extensions; Root: HKCR; Subkey: "Python CompiledFile"; ValueType: string; ValueName: ""; ValueData: "Compiled Python File"; Flags: uninsdeletekey
Tasks: extensions; Root: HKCR; Subkey: "Python CompiledFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\pyc.ico"
Tasks: extensions; Root: HKCR; Subkey: "Python CompiledFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\python.exe"" ""%1"" %*"

; Register .pyo
Tasks: extensions; Root: HKCR; Subkey: ".pyo"; ValueType: string; ValueName: ""; ValueData: "Python CompiledFile"; Flags: uninsdeletevalue

; Register .pyw
Tasks: extensions; Root: HKCR; Subkey: ".pyw"; ValueType: string; ValueName: ""; ValueData: "Python NoConFile"; Flags: uninsdeletevalue
Tasks: extensions; Root: HKCR; Subkey: ".pyw"; ValueType: string; ValueName: "Content Type"; ValueData: "text/plain"; Flags: uninsdeletevalue
Tasks: extensions; Root: HKCR; Subkey: "Python NoConFile"; ValueType: string; ValueName: ""; ValueData: "Python File (no console)"; Flags: uninsdeletekey
Tasks: extensions; Root: HKCR; Subkey: "Python NoConFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Py.ico"
Tasks: extensions; Root: HKCR; Subkey: "Python NoConFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\pythonw.exe"" ""%1"" %*"

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

; This is the whole ball of wax for an Inno installer for Python.
; To use, download Inno Setup from http://www.jrsoftware.org/isdl.htm/,
; install it, and double-click on this file.  That launches the Inno
; script compiler.  The GUI is extemely simple, and has only one button
; you may not recognize instantly:  click it.  You're done.  It builds
; the installer into PCBuild/Python-2.2a1.exe.  Size and speed of the
; installer are competitive with the Wise installer; Inno uninstall
; seems much quicker than Wise.
;
; What's Done
; -----------
; All the usual Windows Python files are installed by this now.
; All the usual Windows Python Start menu entries are created and
; work fine.
; The Python install is fully functional for "typical" uses (e.g.,
; nothing I ever do with Python requires more than this).
;
; What's Not Done
; ---------------
; No registry entries are written.
; No installation of files is done into the system dir:
;     The MS DLLs aren't handled at all by this yet.
;     Python22.dll is unpacked into the main Python dir.
;
; Inno can't do different things on NT/2000 depending on whether the user
; has Admin privileges, so I don't know how to "solve" either of those,
; short of building two installers (one *requiring* Admin privs, the
; other not doing anything that needs Admin privs).
;
; Inno has no concept of variables, so lots of lines in this file need
; to be fiddled by hand across releases.  Simplest way out:  stick this
; file in a giant triple-quoted r-string (note that backslashes are
; required all over the place here -- forward slashes DON'T WORK in
; Inno), and use %(yadda)s string interpolation to do substitutions; i.e.,
; write a very simple Python program to *produce* this script.

[Setup]
; Which of these controls App Path???
AppName=Python 2.2 alpha 1
AppVerName=Python 2.2 alpha 1
AppVersion=2.2a1
AppCopyright=Copyright  2001 Python Software Foundation

; Default install dir; value of {app} later (unless user overrides).
; {sd} = system root drive, probably "C:".
DefaultDirName={sd}\Python22

; Start menu folder name.
DefaultGroupName=Python 2.2

AppId=Python 2.2

; Point SourceDir to one above PCBuild = src.
; YAY!  That actually worked:  means this script can run unchanged from anyone's
; CVS tree, no matter what they called the top-level directories.  Wise
; required hardcoded absolute paths all over the place.
SourceDir=..
OutputDir=PCBuild
OutputBaseFilename=Python-2.2a1

AppPublisher=PythonLabs at Digicool
AppPublisherURL=http://www.python.org
AppSupportURL=http://www.python.org
AppUpdatesURL=http://www.python.org

AlwaysCreateUninstallIcon=yes
ChangesAssociations=yes
UninstallLogMode=new
;LicenseFile=LICENSE
;InfoBeforeFile=Misc\NEWS
; uncomment the following line if you want your installation to run on NT 3.51 too.
; MinVersion=4,3.51

[Types]
Name: normal; Description: "Select desired components"; Flags: iscustom

[Components]
Name: main;  Description: "Python interpreter and library"; Types: normal
Name: docs;  Description: "Python documentation (HTML)";    Types: normal
Name: tools; Description: "Python utility scripts";         Types: normal
Name: test;  Description: "Python test suite (Lib\test\)";  Types: normal

[Files]
; Caution:  Using forward slashes instead screws up in amazing ways.
; Unknown:  By the time Components (and other attrs) are added to these lines, they're
; going to get awfully long.  But don't see a way to continue logical lines across
; physical lines.

Source: LICENSE;   DestDir: "{app}"; DestName: LICENSE.txt; CopyMode: alwaysoverwrite
Source: README;    DestDir: "{app}"; DestName: README.txt;  CopyMode: alwaysoverwrite
Source: Misc\News; DestDir: "{app}"; DestName: NEWS.txt;    CopyMode: alwaysoverwrite
Source: PC\*.ico;  DestDir: "{app}";                        CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\python.exe;   DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\pythonw.exe;  DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\w9xpopen.exe; DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\python22.dll; DestDir: "{app}"; CopyMode: alwaysoverwrite; Components: main

Source: ..\tcl\bin\tcl83.dll; DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: ..\tcl\bin\tk83.dll;  DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: ..\tcl\lib\*.*;       DestDir: "{app}\tcl";  CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs

Source: PCbuild\_socket.pyd;     DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_socket.lib;     DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_sre.pyd;        DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_sre.lib;        DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_symtable.pyd;   DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_symtable.lib;   DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_testcapi.pyd;   DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_testcapi.lib;   DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_tkinter.pyd;    DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_tkinter.lib;    DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\bsddb.pyd;       DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\bsddb.lib;       DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\mmap.pyd;        DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\mmap.lib;        DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\parser.pyd;      DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\parser.lib;      DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\pyexpat.pyd;     DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\pyexpat.lib;     DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\select.pyd;      DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\select.lib;      DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\unicodedata.pyd; DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\unicodedata.lib; DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\_winreg.pyd;     DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\_winreg.lib;     DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\winsound.pyd;    DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\winsound.lib;    DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\zlib.pyd;        DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: PCbuild\zlib.lib;        DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: PCbuild\python22.lib;    DestDir: "{app}\libs"; CopyMode: alwaysoverwrite; Components: main

Source: ..\expat\bin\xmlparse.dll; DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main
Source: ..\expat\bin\xmltok.dll;   DestDir: "{app}\DLLs"; CopyMode: alwaysoverwrite; Components: main

Source: Lib\*.py; DestDir: "{app}\Lib"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\lib-tk\*.py; DestDir: "{app}\Lib\lib-tk"; CopyMode: alwaysoverwrite; Components: main

Source: Lib\encodings\*.py; DestDir: "{app}\Lib\encodings"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\distutils\*.py; DestDir: "{app}\Lib\distutils"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\xml\*.py; DestDir: "{app}\Lib\xml"; CopyMode: alwaysoverwrite; Flags: recursesubdirs; Components: main
Source: Lib\lib-old\*.py;  DestDir: "{app}\Lib\lib-old"; CopyMode: alwaysoverwrite; Components: main
Source: Lib\site-packages\README; DestDir: "{app}\Lib\site-packages"; DestName: README.txt; CopyMode: alwaysoverwrite; Components: main
Source: Include\*.h; DestDir: "{app}\include"; CopyMode: alwaysoverwrite; Components: main
Source: PC\config.h; DestDir: "{app}\include"; CopyMode: alwaysoverwrite; Components: main

Source: Tools\scripts\*.py;  DestDir: "{app}\Tools\Scripts";  CopyMode: alwaysoverwrite; Components: tools
Source: Tools\scripts\*.pyw; DestDir: "{app}\Tools\Scripts";  CopyMode: alwaysoverwrite; Components: tools
Source: Tools\scripts\*.doc; DestDir: "{app}\Tools\Scripts";  CopyMode: alwaysoverwrite; Components: tools
Source: Tools\scripts\README; DestDir: "{app}\Tools\Scripts"; DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools

Source: Tools\webchecker\*.py;   DestDir: "{app}\Tools\webchecker"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\webchecker\README; DestDir: "{app}\Tools\webchecker"; DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools

Source: Tools\versioncheck\*.py;   DestDir: "{app}\Tools\versioncheck"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\versioncheck\README; DestDir: "{app}\Tools\versioncheck"; DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools

Source: Tools\idle\*.py;      DestDir: "{app}\Tools\idle";       CopyMode: alwaysoverwrite; Components: tools
Source: Tools\idle\idle.pyw;  DestDir: "{app}\Tools\idle";       CopyMode: alwaysoverwrite; Components: tools
Source: Tools\idle\*.txt;     DestDir: "{app}\Tools\idle";       CopyMode: alwaysoverwrite; Components: tools
Source: Tools\idle\Icons\*.*; DestDir: "{app}\Tools\idle\Icons"; CopyMode: alwaysoverwrite; Components: tools

Source: Tools\compiler\*.py;           DestDir: "{app}\Tools\compiler";          CopyMode: alwaysoverwrite; Components: tools
Source: Tools\compiler\compiler\*.py;  DestDir: "{app}\Tools\compiler\compiler"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\compiler\compiler\*.txt; DestDir: "{app}\Tools\compiler\compiler"; CopyMode: alwaysoverwrite; Components: tools

Source: Tools\pynche\*.py;       DestDir: "{app}\Tools\pynche";   CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\pynche.pyw; DestDir: "{app}\Tools\pynche";   CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\X\*.txt;    DestDir: "{app}\Tools\pynche\X"; CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\README;     DestDir: "{app}\Tools\pynche";   DestName: README.txt;      CopyMode: alwaysoverwrite; Components: tools
Source: Tools\pynche\pynche;     DestDir: "{app}\Tools\pynche";   DestName: pynche.py;       CopyMode: alwaysoverwrite; Components: tools

Source: html\*.*; DestDir: "{app}\Doc"; CopyMode: alwaysoverwrite; Flags: recursesubdirs; Components: docs

Source: Lib\test\*.py;         DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\*.uue;        DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\*.xml;        DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\*.out;        DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\audiotest.au; DestDir: "{app}\Lib\test";        CopyMode: alwaysoverwrite; Components: test
Source: Lib\test\output\*.*;   DestDir: "{app}\Lib\test\output"; CopyMode: alwaysoverwrite; Components: test

[Icons]
Name: "{group}\IDLE (Python GUI)"; Filename: "{app}\pythonw.exe"; WorkingDir: "{app}"; Parameters: "{app}\Tools\idle\idle.pyw"
Name: "{group}\Module Docs"; Filename: "{app}\pythonw.exe"; WorkingDir: "{app}"; Parameters: "{app}\Tools\Scripts\pydoc.pyw"
Name: "{group}\Python (command line)"; Filename: "{app}\python.exe"; WorkingDir: "{app}"
Name: "{group}\Python Manuals"; Filename: "{app}\Doc\index.html"; WorkingDir: "{app}"


Update download url

Update download url

; -- Example1.iss --
; Demonstrates copying 3 files and creating an icon.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[Setup]
AppName=AppHarbor CLI
AppPublisher=AppHarbor, Inc.
AppPublisherURL=https://appharbor.com
AppSupportURL=http://support.appharbor.com
AppUpdatesURL=https://appharbor-cli.s3.amazonaws.com
AppVersion=1.1
ChangesEnvironment=yes
Compression=lzma2
DefaultDirName={pf}\AppHarbor
OutputDir=userdocs:AppHarbor CLI setup output
SolidCompression=yes

[Files]
Source: "..\src\AppHarbor\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "*.xml,*.pdb"

[Registry]
root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: NeedsAddPath(ExpandConstant('{app}'))

[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;

; -- Example1.iss --
; Demonstrates copying 3 files and creating an icon.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[Setup]
AppName=AppHarbor CLI
AppPublisher=AppHarbor, Inc.
AppPublisherURL=https://appharbor.com
AppSupportURL=http://support.appharbor.com
AppUpdatesURL=http://appharbor-cli.s3.amazonaws.com
AppVersion=1.1
ChangesEnvironment=yes
Compression=lzma2
DefaultDirName={pf}\AppHarbor
OutputDir=userdocs:AppHarbor CLI setup output
SolidCompression=yes

[Files]
Source: "..\src\AppHarbor\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes: "*.xml,*.pdb"

[Registry]
root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: NeedsAddPath(ExpandConstant('{app}'))

[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;


Add copyright and file version to installer

#define MyAppName "Accessibility Viewer"
#define MyAppShortName "aViewer"
#define MyAppVersion GetFileProductVersion('./aViewer64bit.exe')
;defined in ISPPBuiltins.iss
#define MyAppPublisher "The Paciello Group"
#define MyAppURL "https://www.paciellogroup.com/"
#define MyAppExeName "aViewer.exe"

[Setup]
AppId={{21E73CD4-C351-4D38-9C85-CFCA7FA2514A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppCopyright=© {#MyAppPublisher}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir=release
OutputBaseFilename={#MyAppShortName}{#MyAppVersion}
Compression=lzma
SolidCompression=yes
ShowUndisplayableLanguages=yes
ShowLanguageDialog=yes
ArchitecturesInstallIn64BitMode=x64

[Languages]
Name: "Default"; MessagesFile: "compiler:Default.isl"
;Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
;Name: "Czech"; MessagesFile: "compiler:Languages\Czech.isl"
;Name: "Dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
;Name: "French"; MessagesFile: "compiler:Languages\French.isl"
;Name: "German"; MessagesFile: "compiler:Languages\German.isl"
;Name: "Hindi"; MessagesFile: "compiler:Languages\Hindi.islu"
;Name: "Italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "Japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
;Name: "Korean"; MessagesFile: "compiler:Languages\Korean.isl"
;Name: "Russian"; MessagesFile: "compiler:Languages\Russian.isl"
;Name: "Spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
; Remember to install 3rd party ChineseSimplified (and rename to Chinese), Hindi and Korean language files from http://www.jrsoftware.org/files/istrans/ and use Unicode InnoSetup

[Files]
Source: "./aViewer64bit.exe"; DestDir: "{pf}\{#MyAppName}"; DestName: "{#MyAppExeName}"; Check: Is64BitInstallMode; Flags: ignoreversion
Source: "./aViewer32bit.exe"; DestDir: "{pf}\{#MyAppName}"; DestName: "{#MyAppExeName}"; Check: not Is64BitInstallMode; Flags: ignoreversion
Source: "./lang\*.ini"; DestDir: "{pf}\{#MyAppName}\lang"; Flags: ignoreversion
Source: "./IAccessible2Proxy64bit.dll"; DestDir: "{pf}\{#MyAppName}"; DestName: "IAccessible2Proxy.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
Source: "./IAccessible2Proxy32bit.dll"; DestDir: "{pf}\{#MyAppName}"; DestName: "IAccessible2Proxy.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion

[Dirs]
Name: "{pf}\{#MyAppName}"; Permissions: users-readexec;
Name: "{pf}\{#MyAppName}\lang"; Permissions: users-readexec;

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

[UninstallDelete]
Type: files; Name: "{pf}\{#MyAppName}\*.*";
Type: filesandordirs; Name: "{pf}\{#MyAppName}";

[Code]
const
  CSIDL_PERSONAL = $0005;
procedure CurStepChanged(CurStep: TSetupStep);
var
  lang, ini, path: string;
begin
  if CurStep = ssDone then
  begin
    path := GetShellFolderByCSIDL(CSIDL_PERSONAL, False);
    if path <> '' then
    begin
      lang := ActiveLanguage + '.ini';
      ini := path + '\MSAAV.ini';
      SetIniString('Settings', 'LangFile', lang, ini);
    end;
  end;
end;

#define MyAppName "Accessibility Viewer"
#define MyAppShortName "aViewer"
#define MyAppVersion GetFileProductVersion('./aViewer64bit.exe')
;defined in ISPPBuiltins.iss
#define MyAppPublisher "The Paciello Group"
#define MyAppURL "https://www.paciellogroup.com/"
#define MyAppExeName "aViewer.exe"

[Setup]
AppId={{21E73CD4-C351-4D38-9C85-CFCA7FA2514A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir=release
OutputBaseFilename={#MyAppShortName}{#MyAppVersion}
Compression=lzma
SolidCompression=yes
ShowUndisplayableLanguages=yes
ShowLanguageDialog=yes
ArchitecturesInstallIn64BitMode=x64

[Languages]
Name: "Default"; MessagesFile: "compiler:Default.isl"
;Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
;Name: "Czech"; MessagesFile: "compiler:Languages\Czech.isl"
;Name: "Dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
;Name: "French"; MessagesFile: "compiler:Languages\French.isl"
;Name: "German"; MessagesFile: "compiler:Languages\German.isl"
;Name: "Hindi"; MessagesFile: "compiler:Languages\Hindi.islu"
;Name: "Italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "Japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
;Name: "Korean"; MessagesFile: "compiler:Languages\Korean.isl"
;Name: "Russian"; MessagesFile: "compiler:Languages\Russian.isl"
;Name: "Spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
; Remember to install 3rd party ChineseSimplified (and rename to Chinese), Hindi and Korean language files from http://www.jrsoftware.org/files/istrans/ and use Unicode InnoSetup

[Files]
Source: "./aViewer64bit.exe"; DestDir: "{pf}\{#MyAppName}"; DestName: "{#MyAppExeName}"; Check: Is64BitInstallMode; Flags: ignoreversion
Source: "./aViewer32bit.exe"; DestDir: "{pf}\{#MyAppName}"; DestName: "{#MyAppExeName}"; Check: not Is64BitInstallMode; Flags: ignoreversion
Source: "./lang\*.ini"; DestDir: "{pf}\{#MyAppName}\lang"; Flags: ignoreversion
Source: "./IAccessible2Proxy64bit.dll"; DestDir: "{pf}\{#MyAppName}"; DestName: "IAccessible2Proxy.dll"; Check: Is64BitInstallMode; Flags: ignoreversion
Source: "./IAccessible2Proxy32bit.dll"; DestDir: "{pf}\{#MyAppName}"; DestName: "IAccessible2Proxy.dll"; Check: not Is64BitInstallMode; Flags: ignoreversion

[Dirs]
Name: "{pf}\{#MyAppName}"; Permissions: users-readexec;
Name: "{pf}\{#MyAppName}\lang"; Permissions: users-readexec;

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

[UninstallDelete]
Type: files; Name: "{pf}\{#MyAppName}\*.*";
Type: filesandordirs; Name: "{pf}\{#MyAppName}";

[Code]
const
  CSIDL_PERSONAL = $0005;
procedure CurStepChanged(CurStep: TSetupStep);
var
  lang, ini, path: string;
begin
  if CurStep = ssDone then
  begin
    path := GetShellFolderByCSIDL(CSIDL_PERSONAL, False);
    if path <> '' then
    begin
      lang := ActiveLanguage + '.ini';
      ini := path + '\MSAAV.ini';
      SetIniString('Settings', 'LangFile', lang, ini);
    end;
  end;
end;


Installer: startup option added

Installer: startup option added

[Setup]
AppName=Simple Camera Viewer
AppId=SimpleCameraViewer
AppVerName=Simple Camera Viewer
DefaultDirName={pf}\Simple Camera Viewer
DefaultGroupName=Simple Camera Viewer
AllowNoIcons=true
OutputDir=.
OutputBaseFilename=SimpleCameraViewer
UsePreviousAppDir=yes

SetupIconFile=..\icon.ico
UninstallDisplayIcon={app}\SimpleCamViewer.exe

WizardImageBackColor=clWhite
ShowTasksTreeLines=yes

SolidCompression=true
LZMANumBlockThreads=4
Compression=lzma2/ultra64
LZMAUseSeparateProcess=yes
LZMABlockSize=8192

[Tasks]
Name: startup; Description: "Automatically run the program when Windows starts"; GroupDescription: "{cm:AdditionalIcons}";

[Files]

;App binaries
Source: binaries/*; DestDir: {app}; Flags: ignoreversion

;Qt binaries
Source: binaries/Qt/*; DestDir: {app}; Flags: ignoreversion recursesubdirs

;MSVC binaries
Source: binaries/msvcr/*; DestDir: {app}; Flags: ignoreversion

[Icons]
Name: {group}\File Commander; Filename: {app}\SimpleCamViewer.exe;
Name: {group}\{cm:UninstallProgram,Simple Camera Viewer}; Filename: {uninstallexe}
Name: {userstartup}\Simple Camera Viewer; Filename: {app}\SimpleCamViewer.exe; Tasks: startup

[Run]
Filename: {app}\SimpleCamViewer.exe; Description: {cm:LaunchProgram,Simple Camera Viewer}; Flags: nowait postinstall skipifsilent

[UninstallDelete]
Type: dirifempty; Name: "{app}"

[Setup]
AppName=Simple Camera Viewer
AppId=SimpleCameraViewer
AppVerName=Simple Camera Viewer
DefaultDirName={pf}\Simple Camera Viewer
DefaultGroupName=Simple Camera Viewer
AllowNoIcons=true
OutputDir=.
OutputBaseFilename=SimpleCameraViewer
UsePreviousAppDir=yes

SetupIconFile=..\icon.ico
UninstallDisplayIcon={app}\SimpleCamViewer.exe

WizardImageBackColor=clWhite
ShowTasksTreeLines=yes

SolidCompression=true
LZMANumBlockThreads=4
Compression=lzma2/ultra64
LZMAUseSeparateProcess=yes
LZMABlockSize=8192

[Files]

;App binaries
Source: binaries/*; DestDir: {app}; Flags: ignoreversion

;Qt binaries
Source: binaries/Qt/*; DestDir: {app}; Flags: ignoreversion recursesubdirs

;MSVC binaries
Source: binaries/msvcr/*; DestDir: {app}; Flags: ignoreversion

[Icons]
Name: {group}\File Commander; Filename: {app}\SimpleCamViewer.exe;
Name: {group}\{cm:UninstallProgram,Simple Camera Viewer}; Filename: {uninstallexe}

[Run]
Filename: {app}\SimpleCamViewer.exe; Description: {cm:LaunchProgram,Simple Camera Viewer}; Flags: nowait postinstall skipifsilent

[UninstallDelete]
Type: dirifempty; Name: "{app}"