; --- 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