Archive: Env var for sub installer - how to set?


Env var for sub installer - how to set?
Hello,

I would really appreciate if somebody can help me here.

This is the scenario I am attempting

1. Main installer calls sub_installer #1 (OpenSSL - 3rd party).
2. Main installer appends env var PATH with the path of application installed in sub_installer #1. (For some reason, it is not done in the sub installer itself. )
3. Main installer executes sub_installer #2 (3rd party) which needs the value in PATH done in step 2.

The step 2 is done as follows:

ReadEnvStr $R0 "PATH"
StrCpy $R0 "$R0;C:\OpenSSL"
System::Call 'Kernel32::SetEnvironmentVariableW(t, t) i("PATH", R0).r0'
StrCmp $0 0 error
Goto done
error:
MessageBox MB_OK "Can't set environment variable"
ReadEnvStr $R0 "PATH"
MessageBox MB_OK $R0
Abort
done:
MessageBox MB_OK "Updated Path temporarily"
ReadEnvStr $R0 "PATH"
MessageBox MB_OK $R0


From what I see during execution, I do get the "Updated Path temporarily" message and the appended PATH in $R0; but the sub_installer #2 does not seem to find the value in PATH (it says OpenSSL is not installed).

Now, If I execute the same steps manually by running the installers and seting the PATH in between, the sub_installer #2 is able to find the OpenSSL installed.

I use NSIS Unicode 2.46, Windows 7 (32 bit).

As per above code, wouldn't the child process (here, sub_installer #2) get the modified PATH?
Am I doing a mistake here?

-SJSJ

http://forums.winamp.com/showthread.php?t=274158


Try Exec '"cmd" /k set' to verify that it is set correctly. (Or Process Explorer)

Also, don't mix t and W, use "SetEnvironmentVariable(t, t)" or "SetEnvironmentVariableW(w, w)"


Thanks Anders, for pointing out the mix-up.
I shall try checking the var as you suggested.


Sorry for the late update.
The issue is fixed.
The problem was in sub_installer #2 (3rd party) as well.
Thanks for pointing the Ansi, Unicode mix up!