This repository was archived by the owner on Jul 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -37,3 +37,50 @@ Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescri
3737[Icons]
3838Name : " {commondesktop}\Cortexso" ; Filename : " {app} \cortex.exe" ; Tasks: desktopicon
3939Name : " {userappdata}\Microsoft\Internet Explorer\Quick Launch\Cortexso" ; Filename : " {app} \cortex.exe" ; Tasks: quicklaunchicon
40+
41+ ; Define the uninstall run section to execute commands before uninstallation
42+ [UninstallRun]
43+ Filename : " {app} \cortex.exe" ; Parameters : " stop" ; StatusMsg : " Stopping Cortexso service..." ; Flags : runhidden
44+
45+ ; Use Pascal scripting to delete the directory for all users
46+ [Code]
47+ function GetUsersFolder : String;
48+ var
49+ WinDir: String;
50+ begin
51+ WinDir := ExpandConstant(' {win}' );
52+ Result := Copy(WinDir, 1 , Pos(' \Windows' , WinDir) - 1 ) + ' \Users' ;
53+ end ;
54+
55+ procedure DeleteUserCortexFolder ;
56+ var
57+ UsersFolder: String;
58+ FindRec: TFindRec;
59+ begin
60+ UsersFolder := GetUsersFolder;
61+ if FindFirst(UsersFolder + ' \*' , FindRec) then
62+ begin
63+ try
64+ repeat
65+ if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 ) and
66+ (FindRec.Name <> ' .' ) and (FindRec.Name <> ' ..' ) then
67+ begin
68+ if DirExists(UsersFolder + ' \' + FindRec.Name + ' \cortex' ) then
69+ begin
70+ DelTree(UsersFolder + ' \' + FindRec.Name + ' \cortex' , True, True, True);
71+ end ;
72+ end ;
73+ until not FindNext(FindRec);
74+ finally
75+ FindClose(FindRec);
76+ end ;
77+ end ;
78+ end ;
79+
80+ procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
81+ begin
82+ if CurUninstallStep = usPostUninstall then
83+ begin
84+ DeleteUserCortexFolder;
85+ end ;
86+ end ;
You can’t perform that action at this time.
0 commit comments