1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
[Files]
Source: "GTK.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall dontcopy
[ Code]
var
Drive: String;
GtkPath: String;
LibPath: String;
LibName: String;
ToBeRun: String;
ResultCode: Integer;
function GetGtkInstalled (): Boolean;
begin
Drive := ExpandConstant('{drive:{tmp}}');
GtkPath := Drive + '\' + 'GTK';
Result := DirExists(GtkPath);
end;
function GetGtkPath (S: String): String;
begin
Result := GtkPath;
end;
function InitializeSetup(): Boolean;
begin
Result = TRUE;
if Result then begin
if not GetGtkInstalled () then begin
if MsgBox('The GTK+ runtime environment has not been found and is required to run My-Prog: do you want to install the GTK+ runtime environment ?' #13#13 'Version <VERSION INFO HERE> is included in this package, but the latest GTK+ can be download from: <http://www.gtk.org/>', mbConfirmation, MB_YESNO) = idYes then begin
ExtractTemporaryFile('GTK.exe');
ToBeRun := ExpandConstant('{tmp}\GTK.exe');
Exec(ToBeRun, '-y', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
ToBeRun := ExpandConstant('/E /H /Y /I {tmp}\GTK') + ' ' + Drive + '\GTK';
Exec('xcopy', ExpandConstant(ToBeRun), '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
Result := GetGtkInstalled ();
if not Result then begin
if (MsgBox('The GTK+ runtime environment is not installed/detected do you want to install My-Porg anyway ?', mbConfirmation, MB_YESNO) = idYes) then begin
Result := TRUE;
end;
end;
end;
end;
[Registry]
Root: HKLM; SubKey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"; ValueType: string; ValueName: "Path"; ValueData: "{reg:HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\,Path};{app}"
Root: HKLM; SubKey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"; ValueType: string; ValueName: "Path"; ValueData: "{reg:HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\,Path};C:\GTK\bin"
[ Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Path, AppDir: string;
Index: Integer;
begin
if CurUninstallStep = usUninstall then
begin
if RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\',
'Path', Path) then
begin
AppDir := ExpandConstant('{app}');
Index := Pos(AppDir, Path);
Delete(Path, Index-1, Length(AppDir)+1);
RegWriteStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\',
'Path', Path);
end;
end;
end;
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "my-prog.exe"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "pixmaps\*"; DestDir: "{app}\pixmaps\"; Components: main; Flags: ignoreversion
Source: "my-prog.ico"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "setup.ico"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "COPYING"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "ChangeLog"; DestDir: "{app}"; Components: main; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\My-Porg"; Filename: "{app}\my-prog.exe"; WorkingDir: "{app}"; IconFilename: "{app}\my-prog.ico"; Components: main
Name: "{group}\{cm:ProgramOnTheWeb,My-Prog description}"; Filename: "my-site-web"; Components: main;
Name: "{group}\{cm:UninstallProgram,My-Prog}"; Filename: "{uninstallexe}"; IconFilename: "{app}\isaacs.ico"; Components: main;
Name: "{commondesktop}\My-Prog"; Filename: "{app}\my-prog.exe"; Tasks: desktopicon; WorkingDir: "{app}"; IconFilename: "{app}\my-prog.ico"; Components: main
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\My-Progr"; Filename: "{app}\my-prog.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon; IconFilename: "{app}\my-prog.ico"; Components: main
[Components]
Name: "main"; Description: "My-Prog"; Types: full compact custom
[Run]
Filename: "{app}\my-prog.exe"; Description: "{cm:LaunchProgram,My-Prog}"; Flags: nowait postinstall skipifsilent |
Partager