diff --git a/installer/install.iss b/installer/install.iss index dfa1e68e63..93cf0910fc 100644 --- a/installer/install.iss +++ b/installer/install.iss @@ -1904,6 +1904,40 @@ begin #endif end; +procedure PreselectShellIntegrationIfMatchingInstall(); +var + RootKey: Integer; + Cmd: String; + AppPath: String; +begin + AppPath := UninstallAppPath; // Set earlier in QueryUninstallValues() + + if AppPath = '' then + Exit; + + if IsAdminLoggedOn then + RootKey := HKEY_LOCAL_MACHINE + else + RootKey := HKEY_CURRENT_USER; + + // Git Bash Here + if RegQueryStringValue(RootKey, + 'SOFTWARE\Classes\Directory\shell\git_shell\command', '', Cmd) then + begin + if Pos(AppPath, Cmd) > 0 then + WizardSelectComponents('ext\shellhere'); + end; + + // Git GUI Here + if RegQueryStringValue(RootKey, + 'SOFTWARE\Classes\Directory\shell\git_gui\command', '', Cmd) then + begin + if Pos(AppPath, Cmd) > 0 then + WizardSelectComponents('ext\guihere'); + end; +end; + + procedure InitializeWizard; var PrevPageID,TabOrder,TopOfLabels,Top,Left:Integer; @@ -1923,6 +1957,9 @@ begin GetDefaultsFromGitConfig('ProgramData'); GetDefaultsFromGitConfig('system'); + // Check if Windows Integration already exists to reapply it during update + PreselectShellIntegrationIfMatchingInstall(); + ChosenOptions:=''; PrevPageID:=wpSelectProgramGroup;