Talk:Path manipulation with all users/current user selection in run-time

From NSIS Wiki
Jump to navigationJump to search

I think I might have found a bug : In function AddToPath, NT part, just when reading the path (either for current or all user) then there is a test (label is : read_path_NT_resume):

     read_path_NT_resume:
      StrCmp $1 "" AddToPath_NTdoIt
         StrCpy $2 "$1;$0"
         Goto AddToPath_NTdoIt

which might lead to $2 not being set (while it IS $2 that is written in the reg either way) in case there was no previous PATH set.

Ok, I know this is a very unlikely bug, since I don't know of anyone without a PATH, yet it is a possible bug. This piece should fix it :

      read_path_NT_resume:
      StrCmp $1 "" AddToPath_NTNoPreviousPath
         StrCpy $2 "$1;$0"
         Goto AddToPath_NTdoIt
      AddToPath_NTNoPreviousPath:
         StrCpy $2 "$0"
         Goto AddToPath_NTDoIt

Comments/corrections should be sent to francoispoyer_at_yahoo.fr since I am very unlikely to come back on this page.

82.236.30.140 03:46, 5 June 2006 (PDT)

Thanks, fixed. --kichik 05:14, 16 June 2006 (PDT)

variable added to path is not expanded until reboot

if we add the variables

%MYROOT%=c:\rootdir %MYLIBS%=%MYROOT%\lib %MYBIN%=%MYROOT%\bin

to the environment and then use EnvVarUpdate to add %MYBIN% to the path, there's a problem. the installer runs, and everything looks fine when you inspect the environment variables via My Computer->Properties->Advanced->Environment Variables, but when you type

>path

at the command prompt, you see (for example):

c:\windows;c:\windows\system32\;%MYBIN%

instead of

c:\windows:c:\windows\system32\;c:\rootdir\bin

until the system is restarted.