; -- 64Bit.iss --
; Demonstrates installation of a program built for the x64 (a.k.a. AMD64)
; architecture.
; To successfully run this installation and the program it installs,
; you must have a "x64" edition of Windows.

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

[Setup]
AppName={{app_name}}
AppVersion={{app_version}}
DefaultDirName={pf}\{{app_name}}
DefaultGroupName={{app_name}}
UninstallDisplayIcon={app}\{{app_icon}}
{%- if license_file %}
LicenseFile={{license_file}}
{%- endif %}
Compression=lzma2
SolidCompression=yes
OutputBaseFilename={{installer_filename}}
OutputDir=.
ChangesAssociations=yes
; "ArchitecturesAllowed=x64" specifies that Setup cannot run on
; anything but x64.
ArchitecturesAllowed=x64
; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
; done in "64-bit mode" on x64, meaning it should use the native
; 64-bit Program Files directory and the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64

[CustomMessages]
CreateStartMenuIcon=Create a &start menu icon
InstallingVCRedist=Installing VC++ 2015 Redistributables...

[Files]
; App Files
Source: "{{app_name.replace(' ', '')}}.exe"; DestDir: "{app}"
{%- for e in external_exe_files %}
Source: {{e}}; DestDir: "{app}"
{%- endfor %}
Source: "*.dll"; DestDir: "{app}"
Source: "*.pyd"; DestDir: "{app}"
Source: "platforms\*.dll"; DestDir: "{app}\platforms"
; Resources
{%- for resources_dir in resources_dirs %}
Source: "{{resources_dir}}\*"; DestDir: "{app}\{{resources_dir}}"; Flags: recursesubdirs
{%- endfor %}
{%- if include_translations %}
Source: "translations\*"; DestDir: "{app}\translations"; Flags: recursesubdirs
{%- endif %}
; Python
Source: packages\*; DestDir: "{app}\packages"; Flags: recursesubdirs
; Additional Files
{%- for f in additional_files %}
Source: {{f}}; DestDir: {app}
{%- endfor %}
; Temp Files
Source: vcredist_x64.exe; DestDir: {tmp}
; Additional temp files
{%- for f in additional_temp_files %}
Source: {{f}}; DestDir: {tmp}
{%- endfor %}

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

[Run]
Filename: {tmp}\vcredist_x64.exe; Parameters: "/q /passive /Q:a /c:""msiexec /q /i vcredist.msi"""; StatusMsg: {cm:InstallingVCRedist}
{%- for rc in run_commands %}
Filename: {{rc['command']}}; Parameters: "{{rc['parameters']}}"; StatusMsg: {{rc['status']}}
{%- endfor %}

{%- if uninstall_commands %}
[UninstallRun]
{%- for rc in uninstall_commands %}
Filename: {{rc['command']}}; Parameters: "{{rc['parameters']}}"; StatusMsg: {{rc['status']}}
{%- endfor %}
{%- endif %}

{%- if uninstall_files %}
[UninstallDelete]
{%- for f in uninstall_files %}
Type: files; Name: {{f}}
{%- endfor %}
{%- endif %}

[Icons]
Name: "{userdesktop}\{{app_name}}"; Filename: "{app}\{{app_name}}.exe"; IconFilename: "{app}\{{app_icon}}"; Tasks: desktopicon
Name: "{group}\{{app_name}}"; Filename: "{app}\{{app_name}}.exe"; WorkingDir: "{app}"; IconFilename: "{app}\{{app_icon}}"; Tasks: startmenuicon
Name: "{group}\{cm:UninstallProgram,{{app_name}}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\{{app_icon}}"; Tasks: startmenuicon

[Registry]
Root: HKCR; Subkey: ".{{file_extension}}"; ValueData: "{{app_name}}"; Flags: uninsdeletevalue; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{{app_name}}"; ValueData: "{{app_name}}"; Flags: uninsdeletekey; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{{app_name}}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{{app_name}}.exe,0";
Root: HKCR; Subkey: "{{app_name}}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{{app_name}}.exe"" ""%1"""
