File size: 1,592 Bytes
279ebac
 
 
 
 
 
bbf8ffa
279ebac
bbf8ffa
279ebac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4375d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279ebac
 
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
; --- Ever Brain Inno Setup Script ---
; Build this script using the Inno Setup Compiler (ISCC.exe)

[Setup]
AppName=Ever Brain
AppVersion=0.1.0
DefaultDirName={localappdata}\EverBrain
DefaultGroupName=Ever Brain
PrivilegesRequired=lowest
OutputDir=..\dist
OutputBaseFilename=EverBrainSetup
Compression=lzma
SolidCompression=yes
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64

[Files]
Source: "..\dist\ever-brain.exe"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{group}\Ever Brain"; Filename: "{app}\ever-brain.exe"

[Registry]
; Add to PATH
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: NeedsAddPath

[Code]
function NeedsAddPath(): Boolean;
var
  Path: string;
begin
  if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path) then
    Result := True
  else
    Result := Pos(ExpandConstant('{app}'), Path) = 0;
end;

procedure CurUninstallStepChanged(UninstallStep: TUninstallStep);
var
  Path: string;
  PosApp: Integer;
begin
  if UninstallStep = usPostUninstall then
  begin
    if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path) then
    begin
      PosApp := Pos(ExpandConstant('{app}'), Path);
      if PosApp > 0 then
      begin
        // Remove the path and the semicolon
        Delete(Path, PosApp, Length(ExpandConstant('{app}')) + 1);
        RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path);
      end;
    end;
  end;
end;

[Run]
Filename: "{app}\ever-brain.exe"; Description: "Check Status"; Flags: postinstall nowait