Inno Setup Modify Path

info from http://www.legroom.net/software/modpath

To use ModPath in your Inno Setup package, follow these steps:
Copy modpath.iss to the same directory as your setup script
Add this statement to your [Setup] section


ChangesEnvironment=true

Add this statement to your [Tasks] section; You can change the Description or Flags. You can also change the Name (as of version 1.4), but it must match the ModPathName setting below.


Name: modifypath; Description: Add application directory to your environmental path; Flags: unchecked

Add the following to the end of your [Code] section; ModPathName defines the name of the task defined above. ModPathType defines whether the user or system path will be modified; this must be either system or user. setArrayLength must specify the total number of dirs to be added; Result[0] contains first directory, Result[1] contains second (optional), etc.


const 
    ModPathName = 'modifypath'; 
    ModPathType = 'user'; 
 
function ModPathDir(): TArrayOfString; 
begin 
    setArrayLength(Result, 1) 
    Result[0] := ExpandConstant('{app}'); 
end; 
#include "modpath.iss"

Once the above statements have been included and compiled into your package, the environmental path will be automatically updated with the main application directory upon installation and uninstallation if the modifypath task is enabled.

setup_gtk.iss


; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
 
[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={{9AF96939-B6BA-49B3-9752-71F169FAEDA5}
AppName=GTK+
AppVersion=2.24.10
;AppVerName=GTK+ 2.24.10
AppPublisher=GTK+ installer by natyna.pl
AppPublisherURL=http://www.natyna.pl/
AppSupportURL=http://www.natyna.pl/
AppUpdatesURL=http://www.natyna.pl/
DefaultDirName={sd}\gtk
LicenseFile=C:\Users\IEUser\Desktop\__gtk_run_time\lgpl-2_1.txt
OutputDir=C:\Users\IEUser\Desktop\__gtk_run_time\setup_gtk
OutputBaseFilename=setup_gtk+
Compression=lzma
SolidCompression=yes
ChangesEnvironment=true
 
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
 
[Tasks]
Name: modifypath; Description: &Add application directory to your system path
 
[Files]
Source: "C:\Users\IEUser\Desktop\__gtk_run_time\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\IEUser\Desktop\__gtk_run_time\etc\*"; DestDir: "{app}\etc"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\IEUser\Desktop\__gtk_run_time\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\IEUser\Desktop\__gtk_run_time\manifest\*"; DestDir: "{app}\manifest"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\IEUser\Desktop\__gtk_run_time\share\*"; DestDir: "{app}\share"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
 
[Code]
const
    ModPathName = 'modifypath';
    ModPathType = 'system';
 
function ModPathDir(): TArrayOfString;
begin
    setArrayLength(Result, 1)
    Result[0] := ExpandConstant('{app}\bin');
end;
#include "modpath.iss"