feat(installer): remove application path from PATH during uninstallation

Description

Remove application path from PATH during uninstallation:

  • refactor NeedsAddPath to HasPath with inverted logic for clarity
  • extract GetRegPathKey function to reduce duplication
  • implement RemovePath procedure to clean up PATH variable on uninstall
  • handle edge cases for path removal (beginning, middle, end of PATH)
  • register CurUninstallStepChanged to trigger cleanup during uninstall

Related issue: #1145

Related MR: !2430

How has this been tested?

Downloaded windows_installer Job artifact glab__Windows_x86_64_installer.exe and installed it for the current user:

glab__Windows_x86_64_installer.exe /SP- /SILENT /SUPPRESSMSGBOXES /NORESTART /CURRENTUSER

Afterwards I checked the PATH, it was added. I uninstalled the program and the PATH was updated correctly.

As a further tests, I repeated the installation with the following modifications:

  1. Moved the glab path into the middle of the PATH
  2. Moved the glab path to the top of the PATH

In both cases the uninstallation worked.

I also took the Pascal PATH removal code into the Free Pascal compiler and tested various removals. The handling was as follows, the String was the one to be removed:

Test;String -> Test
Test;String; -> Test;
Test;String;; -> Test;;
String;Test -> Test
;String;Test -> ;Test
;;String;Test -> ;;Test
Test;String;M -> Test;M
Test;String;M; -> Test;M;
;Test;String;M; -> ;Test;M;
Test;;String;M -> Test;;M

Screenshots (if appropriate):

Edited by Oldřich Jedlička

Merge request reports

Loading