1 ; Inno Setup documentation: http://www.jrsoftware.org/ishelp/
5 AppVerName=GHC @ProjectVersion@
6 DefaultDirName={sd}\ghc\ghc-@ProjectVersion@
9 UninstallDisplayIcon={app}\bin\ghci.exe
12 PrivilegesRequired=none
13 ChangesAssociations=yes
14 ChangesEnvironment=yes
15 LicenseFile=distrib/windows-installer-licences.txt
17 ; tasks can be disabled selectively
19 Name: fileassoc; Description: "Associate with .hs/.lhs files"
20 Name: fileassoc\default; Description: "Make this version of GHCi the default"
21 Name: fileassoc\addon; Description: "Add versioned GHCi to right-click menu"
22 Name: fileassoc\icon; Description: "Add icon"
23 Name: path; Description: "Add bin directories to PATH"
25 ; install main payload, license file and icon
27 Source: "bindistprep\ghc-@ProjectVersion@\*"; DestDir: "{app}"; Flags: recursesubdirs
28 Source: "distrib\windows-installer-licences.txt"; DestDir: "{app}\doc"
29 Source: "distrib\hsicon.ico"; DestDir: "{app}\icons"
31 ; Start Menu shortcuts
33 Name: "{group}\@ProjectVersion@\GHCi"; Filename: "{app}\bin\ghci.exe"; WorkingDir: "{app}\bin"
34 Name: "{group}\@ProjectVersion@\GHC Documentation"; Filename: "{app}\doc\html\index.html"
35 Name: "{group}\@ProjectVersion@\GHC Library Documentation"; Filename: "{app}\doc\html\libraries\index.html"
36 Name: "{group}\@ProjectVersion@\GHC Flag Reference"; Filename: "{app}\doc\html\users_guide\flag-reference.html"
39 ; set up file associations
40 ; this does _not_ entirely follow the "play nice" proposal (cf. ticket #916)
41 ; future version should
42 Root: HKCR; Subkey: ".hs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue; Tasks: fileassoc
43 Root: HKCR; Subkey: ".lhs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue; Tasks: fileassoc
44 Root: HKCR; Subkey: "ghc_haskell"; ValueType: string; ValueName: ""; ValueData: "Haskell Source File"; Flags: uninsdeletekeyifempty; Tasks: fileassoc
46 ; make this GHCi the default action
47 Root: HKCR; Subkey: "ghc_haskell\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\ghci.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: fileassoc\default
49 ; add versioned GHCi entry to right-click menu
50 Root: HKCR; Subkey: "ghc_haskell\shell\Open with GHCi @ProjectVersion@"; ValueType: none; ValueName: ""; ValueData: ""; Flags: uninsdeletekey; Tasks: fileassoc\addon
51 Root: HKCR; Subkey: "ghc_haskell\shell\Open with GHCi @ProjectVersion@\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\ghci.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: fileassoc\addon
53 ; associate file type with icon
54 Root: HKCR; Subkey: "ghc_haskell\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\icons\hsicon.ico"; Tasks: fileassoc\icon
56 ; these flags were always set in the past, by the installer
57 ; some programs may rely on them to find GHC
58 Root: HKCU; Subkey: "Software\Haskell\GHC\ghc-@ProjectVersion@"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
59 Root: HKCU; Subkey: "Software\Haskell\GHC"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletevalue
61 ; set the PATH variable, for both GHC and Cabal
62 Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{app}\bin;{olddata}"; Check: NotOnPathAlready('{app}\bin'); Flags: preservestringtype; Tasks: path
63 Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{pf}\Haskell\bin;{olddata}"; Check: NotOnPathAlready('{pf}\Haskell\bin'); Flags: preservestringtype; Tasks: path
66 ; stolen from Gtk2Hs, I'm sure they like us :-)
70 function NotOnPathAlready(NewValue : String): Boolean;
74 // Log('Checking if Gtk2Hs\bin dir is already on the %PATH%');
75 if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path) then
76 begin // Successfully read the value
77 // Log('HKCU\Environment\PATH = ' + Path);
78 NewValue := ExpandConstant(NewValue);
79 // Log('Looking for Gtk2Hs\bin dir in %PATH%: ' + BinDir + ' in ' + Path);
80 if Pos(LowerCase(NewValue), Lowercase(Path)) = 0 then
82 // Log('Did not find Gtk2Hs\bin dir in %PATH% so will add it');
87 // Log('Found Gtk2Hs bin dir in %PATH% so will not add it again');
91 else // The key probably doesn't exist
93 // Log('Could not access HKCU\Environment\PATH so assume it is ok to add it');