Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions cortex-js/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,50 @@ Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescri
[Icons]
Name: "{commondesktop}\Cortexso"; Filename: "{app}\cortex.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Cortexso"; Filename: "{app}\cortex.exe"; Tasks: quicklaunchicon

; Define the uninstall run section to execute commands before uninstallation
[UninstallRun]
Filename: "{app}\cortex.exe"; Parameters: "stop"; StatusMsg: "Stopping Cortexso service..."; Flags: runhidden

; Use Pascal scripting to delete the directory for all users
[Code]
function GetUsersFolder: String;
var
WinDir: String;
begin
WinDir := ExpandConstant('{win}');
Result := Copy(WinDir, 1, Pos('\Windows', WinDir) - 1) + '\Users';
end;

procedure DeleteUserCortexFolder;
var
UsersFolder: String;
FindRec: TFindRec;
begin
UsersFolder := GetUsersFolder;
if FindFirst(UsersFolder + '\*', FindRec) then
begin
try
repeat
if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and
(FindRec.Name <> '.') and (FindRec.Name <> '..') then
begin
if DirExists(UsersFolder + '\' + FindRec.Name + '\cortex') then
begin
DelTree(UsersFolder + '\' + FindRec.Name + '\cortex', True, True, True);
end;
end;
until not FindNext(FindRec);
finally
FindClose(FindRec);
end;
end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
DeleteUserCortexFolder;
end;
end;