|
|
#1 |
|
Junior Member
Join Date: Jul 2015
Posts: 6
|
Reloading System Path after running another Installer
I just jumped into NSIS few days ago and am getting used to this awesome installer. My Installer need to install NodeJs and Run series of Commands against npm to install some packaging. I know how to do all those, which brings me to my problem.
When I invoke NodeJs.msi via ExecWait, it modifies the System path adding its path, but after it exits I cannot get it in my current environment so my subsequent commend fails miserably ![]() I'm finding a way to reload system path after installing nodejs or at least to to get nodejs path added. Is that possible? Is that even the way am supposed to do with NSIS? Thanks, S! |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
There is no single function that does what you want, you would have to read from the two registry locations, combine the results and call SetEnvironmentVariable. All of this has to be done with the system plugin to avoid NSIS string length limitations...
What is the minimum Windows version you need to support? IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Jul 2015
Posts: 6
|
Quote:
I only Support Windows XP up. I don't care about Windows vista too, if it will be problematic. Only XP, 7, 8 and definitely later 10 is my concern right now. Again thank you! |
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
When reading from the registry you need to expand the strings and newer versions of Windows have better helper function for that. Are you using NSIS v3 or v2.46?
It is undocumented but SHGetValue and SHQueryValueEx should expand for you... IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Jul 2015
Posts: 6
|
Quote:
At this point am just as pragmatic as I can get
|
|
|
|
|
|
|
#6 |
|
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Doesn't Node.js create a proper registry entry with (only) it's full installation path somehwere?
If it does, you better read the Node.js installation path from the registry explicitly and then use that to build a fully-qualified path to the executable which you want to run. This way more reliably then relying (hoping) that your executable happens to be on %PATH%. My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
|
|
|
|
#8 |
|
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
HKEY_CURRENT_USER\Software\Node.js\InstallPath
My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jul 2015
Posts: 6
|
Wow Thank you.
I now put it this way after installer quits PHP Code:
|
|
|
|
|
|
#10 |
|
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
It's very bad idea to extend %PATH% like this. That's because NSIS strings are limited to a length of 1024 chars (might be a bit longer, if you use "long string" special build). This means you will easily end up with truncated %PATH%, if your %PATH% happens to be long.
Why work with %PATH% anyway? It's highly unreliable to launch a program without a full path and hope that the system will pick up the proper program from %PATH% (or whatever the "current directory" happens to be). Use a fully-qualified path whenever you can! I suggest you do something like this, if possible for your situation: code: Note this info from Microsoft documentation on CreateProcess() function: If the file name does not contain a directory path, the system searches for the executable file in the following sequence:
My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI Last edited by LoRd_MuldeR; 15th July 2015 at 21:56. |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Jul 2015
Posts: 6
|
Thanks a lot. my problem is solved.
NSIS is really great! |
|
|
|
|
|
#12 | |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
If you cannot detect the path and need to use the new %Path% (very much untested):
Quote:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|