Include ImageJ.cfg for 64-bit

Include ImageJ.cfg for 64-bit

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@8328 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

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

[Setup]
AppName=Micro-Manager-1.4
AppVerName=Micro-Manager-1.4
AppPublisher=UCSF
AppPublisherURL=http://www.micro-manager.org
AppSupportURL=http://www.micro-manager.org
AppUpdatesURL=http://www.micro-manager.org
DefaultDirName=C:/Program Files/Micro-Manager-1.4
DefaultGroupName=Micro-Manager-1.4
OutputBaseFilename=MMSetup_
Compression=lzma
SolidCompression=true
VersionInfoVersion=1.4
VersionInfoCompany=(c)University of California San Francisco
VersionInfoCopyright=(c)University of California San Francisco, (c)100XImaging Inc
AppCopyright=University of California San Francisco, 100XImaging Inc
ShowLanguageDialog=yes
AppVersion=1.4
AppID=31830087-F23D-4198-B67D-AD4A2A69147F
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

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

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

[Files]
; the entire redistributable set
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.ATL\atl90.dll ; DestDir: {app}\Microsoft.VC90.ATL; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.ATL\Microsoft.VC90.ATL.manifest ; DestDir: {app}\Microsoft.VC90.ATL; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\msvcm90.dll ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\msvcp90.dll ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\msvcr90.dll ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfc90.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfc90u.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfcm90.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfcm90u.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\Microsoft.VC90.MFC.manifest ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90CHS.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90CHT.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90DEU.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ENU.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ESN.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ESP.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90FRA.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ITA.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90JPN.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90KOR.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\Microsoft.VC90.MFCLOC.manifest ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.OPENMP\vcomp90.dll ; DestDir: {app}\Microsoft.VC90.OPENMP; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.OPENMP\Microsoft.VC90.OpenMP.manifest ; DestDir: {app}\Microsoft.VC90.OPENMP; Flags: ignoreversion

;
Source: ..\..\3rdparty\jre\* ; DestDir: {app}\jre; Flags: ignoreversion recursesubdirs createallsubdirs

; device libraries
Source: micro-manager\atmcd64d.dll; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\inpoutx64.dll; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\MMCoreJ_wrap.dll; DestDir: {app}; Flags: ignoreversion
Source: ..\drivers\K8061\amd64\libusb0.dll; DestDir: {app}; DestName: libusb0.dll; Flags: ignoreversion
Source: micro-manager\opencv_highgui231.dll; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\opencv_core231.dll; DestDir: {app}; Flags: ignoreversion

; device adapters
Source: micro-manager\mmgr_dal_*.dll; DestDir: {app}; Flags: ignoreversion

; python wrapper
; NOTE: not available for 64-bit version
;Source: micro-manager\_MMCorePy.pyd; DestDir: {app}; Flags: ignoreversion skipifsourcedoesntexist
;Source: micro-manager\MMCorePy.py; DestDir: {app}; Flags: ignoreversion skipifsourcedoesntexist
;Source: micro-manager\MMCoreWrapDemo.py; DestDir: {app}; Flags: ignoreversion skipifsourcedoesntexist

; drivers
;Source: ..\drivers\*; DestDir: {app}\drivers; Flags: ignoreversion recursesubdirs

; beanshell scripts
Source: ..\scripts\*; DestDir: {app}\scripts; Flags: ignoreversion

; configuration files
Source: micro-manager\MMConfig_demo.cfg; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\MMDeviceList*.txt; DestDir: {app}; Flags: ignoreversion

; ImageJ files
Source: ..\..\3rdpartypublic\JavaLauncher\ImageJ.exe; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\ImageJ.cfg; DestDir: {app}; Flags: onlyifdoesntexist; Permissions: users-modify
Source: ..\..\3rdpartypublic\classext\ij.jar; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\IJ_Prefs.txt; DestDir: {app}; Flags: onlyifdoesntexist
Source: micro-manager\macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs
Source: micro-manager\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ..\Install_AllPlatforms\micro-manager\mmplugins\*; DestDir: {app}\mmplugins; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ..\Install_AllPlatforms\micro-manager\mmautofocus\*; DestDir: {app}\mmautofocus; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[DIRS]
Name: "{app}"; Permissions: users-modify

[Icons]
Name: {group}\Micro-Manager-1.4; Filename: {app}\ImageJ.exe; WorkingDir: {app}
Name: {group}\{cm:UninstallProgram,Micro-Manager-1.4}; Filename: {uninstallexe}
Name: {commondesktop}\Micro-Manager 1.4; Filename: {app}\ImageJ.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0

[Run]
Filename: "{app}\ImageJ.exe"; Description: {cm:LaunchProgram,Micro-Manager-1.4}; Flags: nowait postinstall

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

[Setup]
AppName=Micro-Manager-1.4
AppVerName=Micro-Manager-1.4
AppPublisher=UCSF
AppPublisherURL=http://www.micro-manager.org
AppSupportURL=http://www.micro-manager.org
AppUpdatesURL=http://www.micro-manager.org
DefaultDirName=C:/Program Files/Micro-Manager-1.4
DefaultGroupName=Micro-Manager-1.4
OutputBaseFilename=MMSetup_
Compression=lzma
SolidCompression=true
VersionInfoVersion=1.4
VersionInfoCompany=(c)University of California San Francisco
VersionInfoCopyright=(c)University of California San Francisco, (c)100XImaging Inc
AppCopyright=University of California San Francisco, 100XImaging Inc
ShowLanguageDialog=yes
AppVersion=1.4
AppID=31830087-F23D-4198-B67D-AD4A2A69147F
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

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

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

[Files]
; the entire redistributable set
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.ATL\atl90.dll ; DestDir: {app}\Microsoft.VC90.ATL; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.ATL\Microsoft.VC90.ATL.manifest ; DestDir: {app}\Microsoft.VC90.ATL; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\msvcm90.dll ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\msvcp90.dll ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\msvcr90.dll ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest ; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfc90.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfc90u.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfcm90.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\mfcm90u.dll ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFC\Microsoft.VC90.MFC.manifest ; DestDir: {app}\Microsoft.VC90.MFC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90CHS.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90CHT.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90DEU.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ENU.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ESN.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ESP.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90FRA.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90ITA.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90JPN.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\MFC90KOR.dll ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.MFCLOC\Microsoft.VC90.MFCLOC.manifest ; DestDir: {app}\Microsoft.VC90.MFCLOC; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.OPENMP\vcomp90.dll ; DestDir: {app}\Microsoft.VC90.OPENMP; Flags: ignoreversion
Source: ..\..\3rdparty\Microsoft\VisualC++\lib\amd64\Microsoft.VC90.OPENMP\Microsoft.VC90.OpenMP.manifest ; DestDir: {app}\Microsoft.VC90.OPENMP; Flags: ignoreversion

;
Source: ..\..\3rdparty\jre\* ; DestDir: {app}\jre; Flags: ignoreversion recursesubdirs createallsubdirs

; device libraries
Source: micro-manager\atmcd64d.dll; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\inpoutx64.dll; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\MMCoreJ_wrap.dll; DestDir: {app}; Flags: ignoreversion
Source: ..\drivers\K8061\amd64\libusb0.dll; DestDir: {app}; DestName: libusb0.dll; Flags: ignoreversion
Source: micro-manager\opencv_highgui231.dll; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\opencv_core231.dll; DestDir: {app}; Flags: ignoreversion

; device adapters
Source: micro-manager\mmgr_dal_*.dll; DestDir: {app}; Flags: ignoreversion

; python wrapper
; NOTE: not available for 64-bit version
;Source: micro-manager\_MMCorePy.pyd; DestDir: {app}; Flags: ignoreversion skipifsourcedoesntexist
;Source: micro-manager\MMCorePy.py; DestDir: {app}; Flags: ignoreversion skipifsourcedoesntexist
;Source: micro-manager\MMCoreWrapDemo.py; DestDir: {app}; Flags: ignoreversion skipifsourcedoesntexist

; drivers
;Source: ..\drivers\*; DestDir: {app}\drivers; Flags: ignoreversion recursesubdirs

; beanshell scripts
Source: ..\scripts\*; DestDir: {app}\scripts; Flags: ignoreversion

; configuration files
Source: micro-manager\MMConfig_demo.cfg; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\MMDeviceList*.txt; DestDir: {app}; Flags: ignoreversion

; ImageJ files
Source: ..\..\3rdpartypublic\JavaLauncher\ImageJ.exe; DestDir: {app}; Flags: ignoreversion
;Source: micro-manager\ImageJ.cfg; DestDir: {app}; Flags: onlyifdoesntexist
Source: ..\..\3rdpartypublic\classext\ij.jar; DestDir: {app}; Flags: ignoreversion
Source: micro-manager\IJ_Prefs.txt; DestDir: {app}; Flags: onlyifdoesntexist
Source: micro-manager\macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs
Source: micro-manager\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ..\Install_AllPlatforms\micro-manager\mmplugins\*; DestDir: {app}\mmplugins; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ..\Install_AllPlatforms\micro-manager\mmautofocus\*; DestDir: {app}\mmautofocus; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[DIRS]
Name: "{app}"; Permissions: users-modify

[Icons]
Name: {group}\Micro-Manager-1.4; Filename: {app}\ImageJ.exe; WorkingDir: {app}
Name: {group}\{cm:UninstallProgram,Micro-Manager-1.4}; Filename: {uninstallexe}
Name: {commondesktop}\Micro-Manager 1.4; Filename: {app}\ImageJ.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0

[Run]
Filename: "{app}\ImageJ.exe"; Description: {cm:LaunchProgram,Micro-Manager-1.4}; Flags: nowait postinstall


Install script welcome page

Install script welcome page

#define sysfolder "system"
#define version "1.41"
#define target "win7-x64"

[Setup]
AppName=NadekoBot
AppVersion={#version}
AppPublisher=Kwoth
DefaultDirName={pf}\NadekoBot
DefaultGroupName=NadekoBot
UninstallDisplayIcon={app}\{#sysfolder}\nadeko_icon.ico
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:projekti/NadekoInstallerOutput
OutputBaseFilename=NadekoBot-setup-{#version}
AppReadmeFile=http://nadekobot.readthedocs.io/en/1.4/Commands%20List/
ArchitecturesInstallIn64BitMode=x64
UsePreviousSetupType=no
DisableWelcomePage=no

[Files]
;install
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db"
;rename credentials example to credentials, but don't overwrite if it exists
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist;

;reinstall - i want to copy all files, but i don't want to overwrite any data files because users will lose their customization if they don't have a backup,
;            and i don't want them to have to backup and then copy-merge into data folder themselves, or lose their currency images due to overwrite.
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdestfileexists createallsubdirs; Excludes: "*.pdb, *.db, data\*, credentials.json";
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\data\*"; DestDir: "{app}\{#sysfolder}\data"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist createallsubdirs;

;readme
;Source: "readme"; DestDir: "{app}"; Flags: isreadme

[Run]
Filename: "http://nadekobot.readthedocs.io/en/1.4/JSON%20Explanations/"; Flags: postinstall shellexec runasoriginaluser; Description: "Open setup guide"
Filename: "{app}\{#sysfolder}\credentials.json"; Flags: postinstall shellexec runasoriginaluser; Description: "Open credentials file"

[Icons]
; for pretty install directory
Name: "{app}\NadekoBot"; Filename: "{app}\{#sysfolder}\NadekoBot.exe"; IconFilename: "{app}\{#sysfolder}\nadeko_icon.ico"
Name: "{app}\credentials"; Filename: "{app}\{#sysfolder}\credentials.json"
Name: "{app}\data"; Filename: "{app}\{#sysfolder}\data"

; desktop shortcut
Name: "{commondesktop}\NadekoBot"; Filename: "{app}\NadekoBot"; Tasks: desktopicon
; desktop icon checkbox
[Tasks]
Name: desktopicon; Description: "Create a &desktop shortcut";

[Registry]
;make the app run as administrator
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
    ValueType: String; ValueName: "{app}\{#sysfolder}\NadekoBot.exe"; ValueData: "RUNASADMIN"; \
    Flags: uninsdeletekeyifempty uninsdeletevalue;
Root: "HKCU"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
    ValueType: String; ValueName: "{app}\{#sysfolder}\NadekoBot.exe"; ValueData: "RUNASADMIN"; \
    Flags: uninsdeletekeyifempty uninsdeletevalue;

[Messages]
WelcomeLabel2=IMPORTANT! READ BELOW!%n%nIt is recommended that you CLOSE any ANTI VIRUS before continuing.%n%nYou can only update v1.4 or newer.%n%nDo not select your old NadekoBot folder as an install path if it's not 1.4 or newer.

;ask the user if they want to delete all settings
[Code]
var
X: string;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then
  begin
    X := ExpandConstant('{app}');
    if FileExists(X + '\{#sysfolder}\data\NadekoBot.db') then begin
      if MsgBox('Do you want to delete all settings associated with this bot?', mbConfirmation, MB_YESNO) = IDYES then begin
        DelTree(X + '\{#sysfolder}', True, True, True);
      end
    end else begin
      MsgBox(X + '\{#sysfolder}\data\NadekoBot.db doesn''t exist', mbConfirmation, MB_YESNO)
    end
  end;
end;

#define sysfolder "system"
#define version "1.41"
#define target "win7-x64"

[Setup]
AppName=NadekoBot
AppVersion={#version}
AppPublisher=Kwoth
DefaultDirName={pf}\NadekoBot
DefaultGroupName=NadekoBot
UninstallDisplayIcon={app}\{#sysfolder}\nadeko_icon.ico
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:projekti/NadekoInstallerOutput
OutputBaseFilename=NadekoBot-setup-{#version}
AppReadmeFile=http://nadekobot.readthedocs.io/en/1.4/Commands%20List/
ArchitecturesInstallIn64BitMode=x64
UsePreviousSetupType=no

[Files]
;install
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db"
;rename credentials example to credentials, but don't overwrite if it exists
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist;

;reinstall - i want to copy all files, but i don't want to overwrite any data files because users will lose their customization if they don't have a backup,
;            and i don't want them to have to backup and then copy-merge into data folder themselves, or lose their currency images due to overwrite.
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdestfileexists createallsubdirs; Excludes: "*.pdb, *.db, data\*, credentials.json";
Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\data\*"; DestDir: "{app}\{#sysfolder}\data"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist createallsubdirs;

;readme
;Source: "readme"; DestDir: "{app}"; Flags: isreadme

[Run]
Filename: "http://nadekobot.readthedocs.io/en/1.4/JSON%20Explanations/"; Flags: postinstall shellexec runasoriginaluser; Description: "Open setup guide"
Filename: "{app}\{#sysfolder}\credentials.json"; Flags: postinstall shellexec runasoriginaluser; Description: "Open credentials file"

[Icons]
; for pretty install directory
Name: "{app}\NadekoBot"; Filename: "{app}\{#sysfolder}\NadekoBot.exe"; IconFilename: "{app}\{#sysfolder}\nadeko_icon.ico"
Name: "{app}\credentials"; Filename: "{app}\{#sysfolder}\credentials.json"
Name: "{app}\data"; Filename: "{app}\{#sysfolder}\data"

; desktop shortcut
Name: "{commondesktop}\NadekoBot"; Filename: "{app}\NadekoBot"; Tasks: desktopicon
; desktop icon checkbox
[Tasks]
Name: desktopicon; Description: "Create a &desktop shortcut";

[Registry]
;make the app run as administrator
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
    ValueType: String; ValueName: "{app}\{#sysfolder}\NadekoBot.exe"; ValueData: "RUNASADMIN"; \
    Flags: uninsdeletekeyifempty uninsdeletevalue;
Root: "HKCU"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
    ValueType: String; ValueName: "{app}\{#sysfolder}\NadekoBot.exe"; ValueData: "RUNASADMIN"; \
    Flags: uninsdeletekeyifempty uninsdeletevalue;

;ask the user if they want to delete all settings
[Code]
var
X: string;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then
  begin
    X := ExpandConstant('{app}');
    if FileExists(X + '\{#sysfolder}\data\NadekoBot.db') then begin
      if MsgBox('Do you want to delete all settings associated with this bot?', mbConfirmation, MB_YESNO) = IDYES then begin
        DelTree(X + '\{#sysfolder}', True, True, True);
      end
    end else begin
      MsgBox(X + '\{#sysfolder}\data\NadekoBot.db doesn''t exist', mbConfirmation, MB_YESNO)
    end
  end;
end;


update v.

update v.

//#include "ModifyPath.iss"

#define MyAppName "ChronoEngine SW Add-In"
#define MyAppVersion "v7.01"
#define MyAppPublisher "Alessandro Tasora"
#define MyAppURL "http://www.chronoengine.info"
#define MyAppSource "C:\Program Files\chrono_solidworks"

[Setup]
ShowLanguageDialog=yes
UserInfoPage=no
AppCopyright=A.Tasora
AppName={#MyAppName}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultGroupName={#MyAppName}
DefaultDirName={pf}\ChronoSolidworks
WizardImageFile=SetupModern20.bmp
WizardSmallImageFile=SetupModernSmall26.bmp
PrivilegesRequired=admin
;Compression=none
OutputDir=D:\tasora\code\projectchrono\chrono-web-assets\installers
OutputBaseFilename=ChronoEngine_SolidWorks_{#MyAppVersion}
ArchitecturesInstallIn64BitMode=x64

[Files]
Source: {#MyAppSource}\ChronoEngineAddIn.dll; DestDir: {app};  Flags: "sharedfile uninsnosharedfileprompt";
Source: {#MyAppSource}\hacd_CLI.dll; DestDir: {app};  Flags: "sharedfile uninsnosharedfileprompt";
Source: ..\to_put_in_app_dir\*; Excludes: "*\.svn,*.git"; DestDir: {app};  Flags: recursesubdirs createallsubdirs;

[Run]
Filename:"{dotnet40}\RegAsm.exe"; Parameters: /codebase ChronoEngineAddIn.dll;WorkingDir: {app}; StatusMsg: "Registering controls ..."; Flags: runhidden;

[UninstallRun]
Filename:"{dotnet40}\RegAsm.exe"; Parameters: /unregister ChronoEngineAddIn.dll;WorkingDir: {app}; StatusMsg: "Unegistering controls ..."; Flags: runhidden;

[Icons]
Name: "{group}\Getting started"; Filename: "http://www.projectchrono.org"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"

[Registry]
Root: HKLM; Subkey: Software\ChronoSolidworks; ValueType: string; ValueName: InstallPath; ValueData: {app}

[Code]
var
  mFoundSolidWorks: Integer;
  mPathSolidWorks: String;

function myFoundSolidWorks: Boolean;
begin
  Result := mFoundSolidWorks =1;
end;
function myGetPathSolidWorks(Param: String): String;
begin
  Result := mPathSolidWorks;
end;

procedure InitializeWizard;
var
  mTitleSWdir: String;
  mallDirSolidWorks: String;
  mCut: Integer;
  myvers: String;
begin

  // CHECK PYTHON INSTALLATION
  mFoundSolidWorks := 0;

  // ***NOTE**** the following code (that detects the directory where SW is
  // installed) is NOT necessary anymore because in latest revisions this
  // add-in installer does not need such information (it just registers the
  // ChronoEngineAddIn.dll in the COM system)

  //***BEGIN OF NOT USED CODE*** Maybe to remove in future. Just for reference.

  if (IsWin64) then
  begin
    // CASE OF 64 BIT PLATFORM

    // find 64 bit SW v.20:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2020\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.21:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2021\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.22:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2022\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.23:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2023\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.24:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2024\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.25:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2025\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

  end
  else
  begin
    // CASE OF 32 BIT PLATFORM
          mFoundSolidWorks := 0;
  end;

  if mFoundSolidWorks = 0 then
  begin
           //MsgBox('WARNING!'#13#13+
           //    'The installer was not able to detect SolidWorks 64 bit'+
           //    'on your system.'#13#13+
           //    'Maybe your SolidWorks is not yet installed, or not properly installed?'#13+
           //    '(If so,please install SolidWorks 64 bit before installing this plug-in).', mbError, MB_OK);
           //
           //Abort();
  end;

  //***END OF NOT USED CODE***

end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  I: Integer;
  mfilesize: Integer;
begin

      Result := True;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := False;

  { Skip pages that shouldn't be shown }

  //if (PageID = wpSelectDir) then
  //  Result := True
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  S: String;
begin
  { Fill the 'Ready Memo' with the normal settings and the custom settings }
  S :=     'Assuming NET 4.0 framework is installed.' + NewLine + NewLine;
  S := S + 'After the installation do this: launch SolidWorks,' + NewLine;
  S := S + 'then check that the Chrono add-in is activated ' + NewLine;
  S := S + 'by using the Tools/Add-in... menu. '  + NewLine;
  S := S + 'In the Add-ins panel you should find an item called ' + NewLine;
  S := S + 'ChronoEngine SwAddin; set it as active by flagging it.' + NewLine;

  //if (mFoundSolidWorks = 1) then begin
  //  S := S + 'The SolidWorks dll directory is:' + NewLine;
  //  S := S + Space + mPathSolidWorks + NewLine;
  //  S := S + 'so the Chrono::Engine 64 bit add-in module for SolidWorks will be installed in:' + NewLine;
  //  S := S + Space + mPathSolidWorks + 'chronoengine' + NewLine;
  //end

  //if ((mFoundSolidWorks = 0) ) then begin
  //  S := S + 'No installation of SolidWorks 64bit has been detected on this system.' + NewLine;
  //  S := S + 'The Chrono::Engine add-in for SolidWorks CANNOT BE INSTALLED!' + NewLine;
  //end

  Result := S;
end;

//#include "ModifyPath.iss"

#define MyAppName "ChronoEngine SW Add-In"
#define MyAppVersion "v7.00"
#define MyAppPublisher "Alessandro Tasora"
#define MyAppURL "http://www.chronoengine.info"
#define MyAppSource "C:\Program Files\chrono_solidworks"

[Setup]
ShowLanguageDialog=yes
UserInfoPage=no
AppCopyright=A.Tasora
AppName={#MyAppName}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultGroupName={#MyAppName}
DefaultDirName={pf}\ChronoSolidworks
WizardImageFile=SetupModern20.bmp
WizardSmallImageFile=SetupModernSmall26.bmp
PrivilegesRequired=admin
;Compression=none
OutputDir=D:\tasora\code\projectchrono\chrono-web-assets\installers
OutputBaseFilename=ChronoEngine_SolidWorks_{#MyAppVersion}
ArchitecturesInstallIn64BitMode=x64

[Files]
Source: {#MyAppSource}\ChronoEngineAddIn.dll; DestDir: {app};  Flags: "sharedfile uninsnosharedfileprompt";
Source: {#MyAppSource}\hacd_CLI.dll; DestDir: {app};  Flags: "sharedfile uninsnosharedfileprompt";
Source: ..\to_put_in_app_dir\*; Excludes: "*\.svn,*.git"; DestDir: {app};  Flags: recursesubdirs createallsubdirs;

[Run]
Filename:"{dotnet40}\RegAsm.exe"; Parameters: /codebase ChronoEngineAddIn.dll;WorkingDir: {app}; StatusMsg: "Registering controls ..."; Flags: runhidden;

[UninstallRun]
Filename:"{dotnet40}\RegAsm.exe"; Parameters: /unregister ChronoEngineAddIn.dll;WorkingDir: {app}; StatusMsg: "Unegistering controls ..."; Flags: runhidden;

[Icons]
Name: "{group}\Getting started"; Filename: "http://www.projectchrono.org"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"

[Registry]
Root: HKLM; Subkey: Software\ChronoSolidworks; ValueType: string; ValueName: InstallPath; ValueData: {app}

[Code]
var
  mFoundSolidWorks: Integer;
  mPathSolidWorks: String;

function myFoundSolidWorks: Boolean;
begin
  Result := mFoundSolidWorks =1;
end;
function myGetPathSolidWorks(Param: String): String;
begin
  Result := mPathSolidWorks;
end;

procedure InitializeWizard;
var
  mTitleSWdir: String;
  mallDirSolidWorks: String;
  mCut: Integer;
  myvers: String;
begin

  // CHECK PYTHON INSTALLATION
  mFoundSolidWorks := 0;

  // ***NOTE**** the following code (that detects the directory where SW is
  // installed) is NOT necessary anymore because in latest revisions this
  // add-in installer does not need such information (it just registers the
  // ChronoEngineAddIn.dll in the COM system)

  //***BEGIN OF NOT USED CODE*** Maybe to remove in future. Just for reference.

  if (IsWin64) then
  begin
    // CASE OF 64 BIT PLATFORM

    // find 64 bit SW v.20:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2020\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.21:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2021\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.22:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2022\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.23:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2023\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.24:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2024\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

    // find 64 bit SW v.25:
    if RegQueryStringValue(HKEY_LOCAL_MACHINE,
                      'SOFTWARE\SolidWorks\SolidWorks 2025\Setup',
                      'SolidWorks Folder',
                      mallDirSolidWorks) then
    begin
            mPathSolidWorks := mallDirSolidWorks;
            mFoundSolidWorks := 1;
    end;

  end
  else
  begin
    // CASE OF 32 BIT PLATFORM
          mFoundSolidWorks := 0;
  end;

  if mFoundSolidWorks = 0 then
  begin
           //MsgBox('WARNING!'#13#13+
           //    'The installer was not able to detect SolidWorks 64 bit'+
           //    'on your system.'#13#13+
           //    'Maybe your SolidWorks is not yet installed, or not properly installed?'#13+
           //    '(If so,please install SolidWorks 64 bit before installing this plug-in).', mbError, MB_OK);
           //
           //Abort();
  end;

  //***END OF NOT USED CODE***

end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  I: Integer;
  mfilesize: Integer;
begin

      Result := True;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := False;

  { Skip pages that shouldn't be shown }

  //if (PageID = wpSelectDir) then
  //  Result := True
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  S: String;
begin
  { Fill the 'Ready Memo' with the normal settings and the custom settings }
  S :=     'Assuming NET 4.0 framework is installed.' + NewLine + NewLine;
  S := S + 'After the installation do this: launch SolidWorks,' + NewLine;
  S := S + 'then check that the Chrono add-in is activated ' + NewLine;
  S := S + 'by using the Tools/Add-in... menu. '  + NewLine;
  S := S + 'In the Add-ins panel you should find an item called ' + NewLine;
  S := S + 'ChronoEngine SwAddin; set it as active by flagging it.' + NewLine;

  //if (mFoundSolidWorks = 1) then begin
  //  S := S + 'The SolidWorks dll directory is:' + NewLine;
  //  S := S + Space + mPathSolidWorks + NewLine;
  //  S := S + 'so the Chrono::Engine 64 bit add-in module for SolidWorks will be installed in:' + NewLine;
  //  S := S + Space + mPathSolidWorks + 'chronoengine' + NewLine;
  //end

  //if ((mFoundSolidWorks = 0) ) then begin
  //  S := S + 'No installation of SolidWorks 64bit has been detected on this system.' + NewLine;
  //  S := S + 'The Chrono::Engine add-in for SolidWorks CANNOT BE INSTALLED!' + NewLine;
  //end

  Result := S;
end;


windows-installer: Do not require any privileges

This way, users who have write permission to "C:\Program Files" are
presented with an elevated installer that lets them do precisely that,
users without those rights will be presented with an installer that lets
them install into "AppData" in their home directory.

See [1] for some background information. Also note that until Inno Setup
5.1.9 "none" was actually the default, but was changed to "admin" thereon.

Fixes #1964.

[1] https://github.com/git-for-windows/build-extra/commit/23672af723da18e5bc3c679e52106de3c2dec55a

#define MyAppName "Git LFS"

; Arbitrarily choose the x86 executable here as both have the version embedded.
#define MyVersionInfoVersion GetFileVersion("..\..\git-lfs-x86.exe")

; Misuse RemoveFileExt to strip the 4th patch-level version number.
#define MyAppVersion RemoveFileExt(MyVersionInfoVersion)

#define MyAppPublisher "GitHub, Inc."
#define MyAppURL "https://git-lfs.github.com/"
#define MyAppFilePrefix "git-lfs-windows"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppCopyright=GitHub, Inc. and Git LFS contributors
AppId={{286391DE-F778-44EA-9375-1B21AAA04FF0}
AppName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppVersion={#MyAppVersion}
ArchitecturesInstallIn64BitMode=x64
ChangesEnvironment=yes
Compression=lzma
DefaultDirName={pf}\{#MyAppName}
DirExistsWarning=no
DisableReadyPage=True
LicenseFile=..\..\LICENSE.md
OutputBaseFilename={#MyAppFilePrefix}-{#MyAppVersion}
OutputDir=..\..\
PrivilegesRequired=none
SetupIconFile=git-lfs-logo.ico
SolidCompression=yes
UsePreviousAppDir=no
VersionInfoVersion={#MyVersionInfoVersion}
WizardImageFile=git-lfs-wizard-image.bmp
WizardSmallImageFile=git-lfs-logo.bmp

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

[Run]
; Uninstalls the old Git LFS version that used a different installer in a different location:
;  If we don't do this, Git will prefer the old version as it is in the same directory as it.
Filename: "{code:GetExistingGitInstallation}\git-lfs-uninstaller.exe"; Parameters: "/S"; Flags: skipifdoesntexist

[Files]
Source: ..\..\git-lfs-x64.exe; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-lfs.exe"; AfterInstall: InstallGitLFS; Check: Is64BitInstallMode
Source: ..\..\git-lfs-x86.exe; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-lfs.exe"; AfterInstall: InstallGitLFS; Check: not Is64BitInstallMode

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

[Code]
// Uses cmd to parse and find the location of Git through the env vars.
// Currently only used to support running the uninstaller for the old Git LFS version.
function GetExistingGitInstallation(Value: string): string;
var
  TmpFileName: String;
  ExecStdOut: AnsiString;
  ResultCode: integer;

begin
  TmpFileName := ExpandConstant('{tmp}') + '\git_location.txt';

  Exec(
    ExpandConstant('{cmd}'),
    '/C "for %i in (git.exe) do @echo. %~$PATH:i > "' + TmpFileName + '"',
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode
  );

  if LoadStringFromFile(TmpFileName, ExecStdOut) then begin
      if not (Pos('Git\cmd', ExtractFilePath(ExecStdOut)) = 0) then begin
        // Proxy Git path detected
        Result := ExpandConstant('{pf}');
      if Is64BitInstallMode then
        Result := Result + '\Git\mingw64\bin'
      else
        Result := Result + '\Git\mingw32\bin';
      end else begin
        Result := ExtractFilePath(ExecStdOut);
      end;

      DeleteFile(TmpFileName);
  end;
end;

// Checks to see if we need to add the dir to the env PATH variable.
function NeedsAddPath(Param: string): boolean;
var
  OrigPath: string;
  ParamExpanded: string;
begin
  //expand the setup constants like {app} from Param
  ParamExpanded := ExpandConstant(Param);
  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 and with or without \ ending
  // Pos() returns 0 if not found
  Result := Pos(';' + UpperCase(ParamExpanded) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
  if Result = True then
    Result := Pos(';' + UpperCase(ParamExpanded) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
end;

// Runs the lfs initialization.
procedure InstallGitLFS();
var
  ResultCode: integer;
begin
  Exec(
    ExpandConstant('{cmd}'),
    ExpandConstant('/C ""{app}\git-lfs.exe" install"'),
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode
  );
  if not ResultCode = 1 then
    MsgBox(
    'Git LFS was not able to automatically initialize itself. ' +
    'Please run "git lfs install" from the commandline.', mbInformation, MB_OK);
end;

// Event function automatically called when uninstalling:
function InitializeUninstall(): Boolean;
var
  ResultCode: integer;
begin
  Exec(
    ExpandConstant('{cmd}'),
    ExpandConstant('/C ""{app}\git-lfs.exe" uninstall"'),
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode
  );
  Result := True;
end;

#define MyAppName "Git LFS"

; Arbitrarily choose the x86 executable here as both have the version embedded.
#define MyVersionInfoVersion GetFileVersion("..\..\git-lfs-x86.exe")

; Misuse RemoveFileExt to strip the 4th patch-level version number.
#define MyAppVersion RemoveFileExt(MyVersionInfoVersion)

#define MyAppPublisher "GitHub, Inc."
#define MyAppURL "https://git-lfs.github.com/"
#define MyAppFilePrefix "git-lfs-windows"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppCopyright=GitHub, Inc. and Git LFS contributors
AppId={{286391DE-F778-44EA-9375-1B21AAA04FF0}
AppName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppVersion={#MyAppVersion}
ArchitecturesInstallIn64BitMode=x64
ChangesEnvironment=yes
Compression=lzma
DefaultDirName={pf}\{#MyAppName}
DirExistsWarning=no
DisableReadyPage=True
LicenseFile=..\..\LICENSE.md
OutputBaseFilename={#MyAppFilePrefix}-{#MyAppVersion}
OutputDir=..\..\
SetupIconFile=git-lfs-logo.ico
SolidCompression=yes
UsePreviousAppDir=no
VersionInfoVersion={#MyVersionInfoVersion}
WizardImageFile=git-lfs-wizard-image.bmp
WizardSmallImageFile=git-lfs-logo.bmp

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

[Run]
; Uninstalls the old Git LFS version that used a different installer in a different location:
;  If we don't do this, Git will prefer the old version as it is in the same directory as it.
Filename: "{code:GetExistingGitInstallation}\git-lfs-uninstaller.exe"; Parameters: "/S"; Flags: skipifdoesntexist

[Files]
Source: ..\..\git-lfs-x64.exe; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-lfs.exe"; AfterInstall: InstallGitLFS; Check: Is64BitInstallMode
Source: ..\..\git-lfs-x86.exe; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-lfs.exe"; AfterInstall: InstallGitLFS; Check: not Is64BitInstallMode

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

[Code]
// Uses cmd to parse and find the location of Git through the env vars.
// Currently only used to support running the uninstaller for the old Git LFS version.
function GetExistingGitInstallation(Value: string): string;
var
  TmpFileName: String;
  ExecStdOut: AnsiString;
  ResultCode: integer;

begin
  TmpFileName := ExpandConstant('{tmp}') + '\git_location.txt';

  Exec(
    ExpandConstant('{cmd}'),
    '/C "for %i in (git.exe) do @echo. %~$PATH:i > "' + TmpFileName + '"',
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode
  );

  if LoadStringFromFile(TmpFileName, ExecStdOut) then begin
      if not (Pos('Git\cmd', ExtractFilePath(ExecStdOut)) = 0) then begin
        // Proxy Git path detected
        Result := ExpandConstant('{pf}');
      if Is64BitInstallMode then
        Result := Result + '\Git\mingw64\bin'
      else
        Result := Result + '\Git\mingw32\bin';
      end else begin
        Result := ExtractFilePath(ExecStdOut);
      end;

      DeleteFile(TmpFileName);
  end;
end;

// Checks to see if we need to add the dir to the env PATH variable.
function NeedsAddPath(Param: string): boolean;
var
  OrigPath: string;
  ParamExpanded: string;
begin
  //expand the setup constants like {app} from Param
  ParamExpanded := ExpandConstant(Param);
  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 and with or without \ ending
  // Pos() returns 0 if not found
  Result := Pos(';' + UpperCase(ParamExpanded) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
  if Result = True then
    Result := Pos(';' + UpperCase(ParamExpanded) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
end;

// Runs the lfs initialization.
procedure InstallGitLFS();
var
  ResultCode: integer;
begin
  Exec(
    ExpandConstant('{cmd}'),
    ExpandConstant('/C ""{app}\git-lfs.exe" install"'),
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode
  );
  if not ResultCode = 1 then
    MsgBox(
    'Git LFS was not able to automatically initialize itself. ' +
    'Please run "git lfs install" from the commandline.', mbInformation, MB_OK);
end;

// Event function automatically called when uninstalling:
function InitializeUninstall(): Boolean;
var
  ResultCode: integer;
begin
  Exec(
    ExpandConstant('{cmd}'),
    ExpandConstant('/C ""{app}\git-lfs.exe" uninstall"'),
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode
  );
  Result := True;
end;


CFY-7109 remove plugins from cli package installation

#define AppName "Cloudify CLI"
#define AppVersion GetEnv('VERSION')
#define AppMilestone GetEnv('PRERELEASE')
#define AppBuild GetEnv('BUILD')
#define AppPublisher "GigaSpaces Technologies"
#define AppURL "http://getcloudify.org/"
#define PluginsTagName GetEnv('PLUGINS_TAG_NAME')
#define CoreTagName GetEnv('CORE_TAG_NAME')

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{94B9D938-5123-4AC5-AA99-68F07F773DE2}
AppName={#AppName}
AppVersion={#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DefaultDirName={sd}\Cloudify
OutputBaseFilename=cloudify-windows-cli_{#AppVersion}-{#AppMilestone}
Compression=lzma
SolidCompression=yes
ArchitecturesInstallIn64BitMode=
LicenseFile=source\license.txt
MinVersion=6.0
SetupIconFile=source\icons\Cloudify.ico
UninstallDisplayIcon={app}\Cloudify.ico
OutputDir=output\
DisableDirPage=auto
DisableProgramGroupPage=yes

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

[Files]
Source: "source\python\*"; DestDir: "{app}\embedded" ;Flags: recursesubdirs
Source: "source\wheels\*.whl"; Flags: dontcopy
Source: "source\icons\Cloudify.ico"; DestDir: "{app}"
Source: "source\blueprints\*"; DestDir: "{app}\cloudify-manager-blueprints"; Flags: recursesubdirs

Source: "source\types\*"; DestDir: "{app}\cloudify\types"; Flags: recursesubdirs
Source: "source\scripts\*"; DestDir: "{app}\cloudify\scripts"; Flags: recursesubdirs
Source: "source\plugins\*"; DestDir: "{app}\cloudify\plugins"; Flags: recursesubdirs
Source: "source\import_resolver.yaml"; Flags: dontcopy

[Tasks]
Name: "desktopicon"; Description: "Create a desktop icon";

[Icons]
Name: "{userdesktop}\Cloudify CLI"; Filename: "{cmd}"; Parameters: "/k SET PATH=%PATH%;{app}\embedded\Scripts\"; WorkingDir: "{app}"; IconFilename: "{app}\Cloudify.ico"; Tasks: "desktopicon";

[UninstallDelete]
;this is NOT recommended but in our case, no user data here
Type: "filesandordirs"; Name: "{app}"

[Code]
const
  mainPackagesName = 'cloudify cloudify-fabric-plugin';
  //Error messages
  errUnexpected = 'Unexpected error. Run setup with /LOG flag and check the logs for additional details.';
  LF = #10;
  CR = #13;
  CRLF = CR + LF;

function runPipSetup(): Boolean;
var
  GetPipArgs: String;
  ErrorCode: Integer;
begin
  GetPipArgs := '-m ensurepip';
  Exec(Expandconstant('{app}\embedded\python.exe'), GetPipArgs, Expandconstant('{tmp}'), SW_SHOW, ewWaituntilterminated, ErrorCode);
  Log('Installting pip return code: ' + IntToStr(ErrorCode));
  if Errorcode <> 0 then
    Result := False
  else
    Result := True;
end;

function runWheelsInstall(): Boolean;
var
  PipArgs: String;
  ErrorCode: Integer;
  PackagesToInstall: String;
begin
  ExtractTemporaryFiles('*.whl');

  PipArgs := 'install --pre --use-wheel --no-index --find-links . --force-reinstall --ignore-installed ' + mainPackagesName;
  Exec(Expandconstant('{app}\embedded\Scripts\pip.exe'), PipArgs, Expandconstant('{tmp}'), SW_SHOW, ewWaituntilterminated, ErrorCode);
  Log('Installting wheels return code: ' + IntToStr(ErrorCode));

  //Pip seems to return errorcode 2 when it's not clean install
  if (Errorcode = 0) or (Errorcode = 2) then
    Result := True
  else
    Result := False;
end;

function updateConfigYaml(): Boolean;
var
  MappingStrings: TArrayOfString;
  ConfigYamlPath: String;
  Status: Boolean;
  Index: Integer;
begin
  ConfigYamlPath := Expandconstant('{app}\embedded\Lib\site-packages\cloudify_cli\resources\config.yaml')
  ExtractTemporaryFile('import_resolver.yaml');
  Status := LoadStringsFromFile(ExpandConstant('{tmp}\import_resolver.yaml'), MappingStrings);

  if not Status then
  begin
    Result := False;
    Exit;
  end;

  for Index := 0 to GetArrayLength(MappingStrings) - 1 do
  begin
    // setting the path to cloudify dir path
    StringChangeEx(MappingStrings[Index], 'CLOUDIFY_PATH', Expandconstant('{app}'), True);
    // replacing the tags to a current one
    StringChangeEx(MappingStrings[Index], 'CORE_TAG_NAME', ExpandConstant('{#CoreTagName}'), True);
    StringChangeEx(MappingStrings[Index], 'PLUGINS_TAG_NAME', ExpandConstant('{#PluginsTagName}'), True);
    // replacing the end line from linux to both windows and linux
    StringChangeEx(MappingStrings[Index], LF, CRLF, False);
  end;
  Log('Saving new config: ' + ConfigYamlPath);
  Result := SaveStringsToFile(ConfigYamlPath, MappingStrings, True);

end;

//Install Pip, Wheels and update resolver during setup
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then begin
    if not (runPipSetup and runWheelsInstall and updateConfigYaml) then
      RaiseException(errUnexpected);
  end;
end;

#define AppName "Cloudify CLI"
#define AppVersion GetEnv('VERSION')
#define AppMilestone GetEnv('PRERELEASE')
#define AppBuild GetEnv('BUILD')
#define AppPublisher "GigaSpaces Technologies"
#define AppURL "http://getcloudify.org/"
#define PluginsTagName GetEnv('PLUGINS_TAG_NAME')
#define CoreTagName GetEnv('CORE_TAG_NAME')

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{94B9D938-5123-4AC5-AA99-68F07F773DE2}
AppName={#AppName}
AppVersion={#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DefaultDirName={sd}\Cloudify
OutputBaseFilename=cloudify-windows-cli_{#AppVersion}-{#AppMilestone}
Compression=lzma
SolidCompression=yes
ArchitecturesInstallIn64BitMode=
LicenseFile=source\license.txt
MinVersion=6.0
SetupIconFile=source\icons\Cloudify.ico
UninstallDisplayIcon={app}\Cloudify.ico
OutputDir=output\
DisableDirPage=auto
DisableProgramGroupPage=yes

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

[Files]
Source: "source\python\*"; DestDir: "{app}\embedded" ;Flags: recursesubdirs
Source: "source\wheels\*.whl"; Flags: dontcopy
Source: "source\icons\Cloudify.ico"; DestDir: "{app}"
Source: "source\blueprints\*"; DestDir: "{app}\cloudify-manager-blueprints"; Flags: recursesubdirs

Source: "source\types\*"; DestDir: "{app}\cloudify\types"; Flags: recursesubdirs
Source: "source\scripts\*"; DestDir: "{app}\cloudify\scripts"; Flags: recursesubdirs
Source: "source\plugins\*"; DestDir: "{app}\cloudify\plugins"; Flags: recursesubdirs
Source: "source\import_resolver.yaml"; Flags: dontcopy

[Tasks]
Name: "desktopicon"; Description: "Create a desktop icon";

[Icons]
Name: "{userdesktop}\Cloudify CLI"; Filename: "{cmd}"; Parameters: "/k SET PATH=%PATH%;{app}\embedded\Scripts\"; WorkingDir: "{app}"; IconFilename: "{app}\Cloudify.ico"; Tasks: "desktopicon";

[UninstallDelete]
;this is NOT recommended but in our case, no user data here
Type: "filesandordirs"; Name: "{app}"

[Code]
const
  mainPackagesName = 'cloudify cloudify-fabric-plugin cloudify-openstack-plugin cloudify-aws-plugin cloudify-softlayer-plugin cloudify-vsphere-plugin';
  //Error messages
  errUnexpected = 'Unexpected error. Run setup with /LOG flag and check the logs for additional details.';
  LF = #10;
  CR = #13;
  CRLF = CR + LF;

function runPipSetup(): Boolean;
var
  GetPipArgs: String;
  ErrorCode: Integer;
begin
  GetPipArgs := '-m ensurepip';
  Exec(Expandconstant('{app}\embedded\python.exe'), GetPipArgs, Expandconstant('{tmp}'), SW_SHOW, ewWaituntilterminated, ErrorCode);
  Log('Installting pip return code: ' + IntToStr(ErrorCode));
  if Errorcode <> 0 then
    Result := False
  else
    Result := True;
end;

function runWheelsInstall(): Boolean;
var
  PipArgs: String;
  ErrorCode: Integer;
  PackagesToInstall: String;
begin
  ExtractTemporaryFiles('*.whl');

  PipArgs := 'install --pre --use-wheel --no-index --find-links . --force-reinstall --ignore-installed ' + mainPackagesName;
  Exec(Expandconstant('{app}\embedded\Scripts\pip.exe'), PipArgs, Expandconstant('{tmp}'), SW_SHOW, ewWaituntilterminated, ErrorCode);
  Log('Installting wheels return code: ' + IntToStr(ErrorCode));

  //Pip seems to return errorcode 2 when it's not clean install
  if (Errorcode = 0) or (Errorcode = 2) then
    Result := True
  else
    Result := False;
end;

function updateConfigYaml(): Boolean;
var
  MappingStrings: TArrayOfString;
  ConfigYamlPath: String;
  Status: Boolean;
  Index: Integer;
begin
  ConfigYamlPath := Expandconstant('{app}\embedded\Lib\site-packages\cloudify_cli\resources\config.yaml')
  ExtractTemporaryFile('import_resolver.yaml');
  Status := LoadStringsFromFile(ExpandConstant('{tmp}\import_resolver.yaml'), MappingStrings);

  if not Status then
  begin
    Result := False;
    Exit;
  end;

  for Index := 0 to GetArrayLength(MappingStrings) - 1 do
  begin
    // setting the path to cloudify dir path
    StringChangeEx(MappingStrings[Index], 'CLOUDIFY_PATH', Expandconstant('{app}'), True);
    // replacing the tags to a current one
    StringChangeEx(MappingStrings[Index], 'CORE_TAG_NAME', ExpandConstant('{#CoreTagName}'), True);
    StringChangeEx(MappingStrings[Index], 'PLUGINS_TAG_NAME', ExpandConstant('{#PluginsTagName}'), True);
    // replacing the end line from linux to both windows and linux
    StringChangeEx(MappingStrings[Index], LF, CRLF, False);
  end;
  Log('Saving new config: ' + ConfigYamlPath);
  Result := SaveStringsToFile(ConfigYamlPath, MappingStrings, True);

end;

//Install Pip, Wheels and update resolver during setup
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then begin
    if not (runPipSetup and runWheelsInstall and updateConfigYaml) then
      RaiseException(errUnexpected);
  end;
end;