diff --git a/development/Win32/packaging/installer/components/external.nsh b/development/Win32/packaging/installer/components/external.nsh index 899788441f..e8d43835b9 100644 --- a/development/Win32/packaging/installer/components/external.nsh +++ b/development/Win32/packaging/installer/components/external.nsh @@ -56,6 +56,7 @@ External Components: MiKTeX, ImageMagick, Ghostscript install_${component}: ExecWait '"$PLUGINSDIR\${component}Setup.exe"' + Call UpdatePathEnvironment Call Search${component} ${if} $Path${component} == "" diff --git a/development/Win32/packaging/installer/include/windows.nsh b/development/Win32/packaging/installer/include/windows.nsh index db78e88390..6cb2b93712 100644 --- a/development/Win32/packaging/installer/include/windows.nsh +++ b/development/Win32/packaging/installer/include/windows.nsh @@ -47,6 +47,23 @@ Function CheckPriviledges FunctionEnd +Function UpdatePathEnvironment + + Push $R0 + Push $R1 + + ;Updates the path environment variable of the instaler process to the latest system value + + ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path + ReadRegStr $R1 HKCU "Environment" Path + + System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$R0;$R1").r0' + + Pop $R1 + Pop $R0 + +FunctionEnd + Function un.SetShellContext Push $R0