Archive: Problem Editing System Path


Problem Editing System Path
Hi,

I am using the Path Manipulation plugin on the main NSIS website, but whenever I try to use:

Push $antHomeDir\bin
Call AddToPath

To add the ANT bin directory to the path, nothing happens. When I use:

Push $antHomeDir
Call AddToPath

or

Push $javaHome
Call AddToPath

however, the command works perfectly. I have no idea what is going on, and would really appreciate some help.

Thanks!

p.s. I have tried quotes around $antHomeDir\bin but nothing has happened.


Maybe there's already one backslash at the end of $antHomeDir value, so by adding the second with \BIN causes that issue.
Try to debug your script with message boxes and remove one backslash if necessary to see if it works.


I put the following message box:

Message Box MB_OK "$anthomedir\bin"

right before the Path command and got "C:\apache-ant-1.6.0\bin" as the output, which is correct. I then tried this:

Push "C:\apache-ant-1.6.0\bin"
Call AddToPath

But even that didn't work. Any other ideas?

Thanks.


Make sure the directory exists prior to adding it. AddToPath doesn't add non-existing paths.


The directory does already exist before the command is called. I've even tried:

Push "PATH"
Push $antHomeDir\bin
Call AddToEnvVar

but that doesn't work either.


Then it must think the directory is already in the PATH for some reason. Are you sure it's not in the user's local PATH?


Nope, its not already there. Maybe this particular plugin just doesn't like the syntax of the ANT directory...Are there any other path manipulation plugins out there that I could try?


It's not a plug-in, it's a script. You can take a look at the code and even modify it to find out where it stops.

The syntax of the directory is fine. It's perfectly normal.

The script only stops for two reasons which I've already mentioned. Maybe you're running the installer from an environment where the PATH is already set, so it doesn't add it again. You can add some debugging code to AddToPath to make sure.