; GNU Prolog WIN32 installation script for Inno Setup 4

[Setup]
AppName=GNU Prolog
AppVerName=GNU Prolog version @PROLOG_VERSION@
AppVersion=@PROLOG_VERSION@
AppPublisher=Daniel Diaz
AppPublisherURL=http://www.gprolog.org
AppSupportURL=http://www.gprolog.org 
AppUpdatesURL=http://www.gprolog.org
SetupIconFile=gprolog.ico
DefaultDirName={sd}\GNU-Prolog
DefaultGroupName=GNU Prolog
AllowNoIcons=yes
SourceDir=@WIN_TMP_DIR@\gprolog_win32
OutputDir=@WIN_TMP_DIR@
OutputBaseFileName=setup-gprolog-@PROLOG_VERSION@-@WIN_CC_VER@

ChangesAssociations=yes

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

[Tasks]
Name: desktopicon; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; 

Name: assocPl; Description: "&Associate GNU Prolog with .pl files"; GroupDescription: "File associations:";
Name: assocPro; Description: "A&ssociate GNU Prolog with .pro files"; GroupDescription: "File associations:";

[Files]
Source: "*.*"; DestDir: "{app}";  Flags: ignoreversion
Source: "bin\*.*"; DestDir: "{app}\bin";  Flags: ignoreversion
Source: "lib\*.*"; DestDir: "{app}\lib";  Flags: ignoreversion
Source: "lib\*.dll"; DestDir: "{app}\bin";  Flags: ignoreversion skipifsourcedoesntexist
Source: "include\*.*"; DestDir: "{app}\include";  Flags: ignoreversion
Source: "doc\*.*"; DestDir: "{app}\doc";  Flags: ignoreversion
Source: "doc\html_node\*.*"; DestDir: "{app}\doc\html_node";  Flags: ignoreversion
Source: "examples\ExamplesPl\*.*"; DestDir: "{app}\examples\ExamplesPl";  Flags: ignoreversion
Source: "examples\ExamplesFD\*.*"; DestDir: "{app}\examples\ExamplesFD";  Flags: ignoreversion
Source: "examples\ExamplesC\*.*"; DestDir: "{app}\examples\ExamplesC";  Flags: ignoreversion

[INI]
Filename: "{app}\gprolog.url"; Section: "InternetShortcut"; Key: "URL"; String: "http://www.gprolog.org"

[Icons]
Name: "{group}\GNU Prolog"; Filename: "{app}\bin\gprolog.exe"
Name: "{group}\Help"; Filename: "{app}\doc\gprolog.chm"
Name: "{group}\Html Manual"; Filename: "{app}\doc\html_node\index.html"
Name: "{group}\The GNU Prolog Web Site"; Filename: "{app}\gprolog.url"
Name: "{group}\Uninstall GNU Prolog"; Filename: "{uninstallexe}"

Name: "{userdesktop}\GNU Prolog"; Filename: "{app}\bin\gprolog.exe"; MinVersion: 4,4; Tasks: desktopicon


[Registry]
Root: HKCU; Subkey: "Software\GnuProlog"; ValueType: string; ValueName: "Version"; ValueData: "@PROLOG_VERSION@"
Root: HKCU; Subkey: "Software\GnuProlog"; ValueType: string; ValueName: "RootPath"; ValueData: "{app}"

; create an association for .pl and .pro files

Root: HKCR; Subkey: ".pl"; ValueType: string; ValueName: ""; ValueData: "PrologFile"; Flags: uninsdeletevalue; Tasks: assocPl
Root: HKCR; Subkey: ".pro"; ValueType: string; ValueName: ""; ValueData: "PrologFile"; Flags: uninsdeletevalue; Tasks: assocPro

Root: HKCR; Subkey: "PrologFile"; ValueType: string; ValueName: ""; ValueData: "Prolog File"; Flags: uninsdeletekey; Tasks: assocPl assocPro
Root: HKCR; Subkey: "PrologFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\gprolog.exe,0"; Tasks: assocPl assocPro
Root: HKCR; Subkey: "PrologFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\gprolog.exe"" --entry-goal ""consult(`%1`)"""; Tasks: assocPl assocPro


[Run]
Filename: "{app}\bin\create_bat.exe"; Parameters: """{app}"""; Description: "Create {app}\gprologvars.bat"
Filename: "{app}\bin\gprolog.exe"; Description: "Launch GNU Prolog"; Flags: nowait postinstall skipifsilent

[UninstallDelete]
Type: files; Name: "{app}\gprologvars.bat"
Type: files; Name: "{app}\gprolog.url"


