Archive: Modified Set CLASSPATH code doesn't work?!


Modified Set CLASSPATH code doesn't work?!
Hello all:

I need to know how to add and delete CLASSPATH during the installation procedure.

I DO search the forum and get the source code for
modifying the PATH environment variable and it works great.

However, when I try to modify the code to handle with
CLASSPATH environment variable, it doesn't work for me.

The original code I got from the following link
http://nsis.sourceforge.net/archive/...88&instances=0
" Path manipulation with all users/current user selection in run-time"

I do the following modification and try to make this code work for CLASSPATH, however I fail.

1> change un.**** to un****, because the compiler gave me some errors
2> change all PATH to CLASSPATH


Could anyone give me some comment for why the code can not successful modify(add & delete) CLASSPATH?

please see the attachment:)

best wishses
-daniel


Hello all:

Finally, I found the solution to my above question.

I don't know whether or not we can count this as a bug in the original code.
http://nsis.sourceforge.net/archive/...88&instances=0

The modified version of original code works iff the CLASSPATH is not empty.
If the CLASSPATH before you modify is empty, then the code doesn't work.


However, you can work around by modifying the above posted code with using the following snippet:
///////////////////////////////////////////////////////////////////////////////
AddToPath_NT_selection_done:
StrCmp $4 "current" read_path_NT_current
ReadRegStr $1 ${NT_all_env_class} "CLASSPATH"
StrCmp $1 "" +1 +2
StrCpy $1 " " ; If the all users' CLASSPATH is empty, assign " " to it. Modified by Danyu 2005/03/09 20:07PM

Goto read_path_NT_resume
read_path_NT_current:
ReadRegStr $1 ${NT_current_env_class} "CLASSPATH"
StrCmp $1 "" +1 +2
StrCpy $1 " " ; If the current user's CLASSPATH is empty, assign " " to it. Modified by Danyu 2005/03/09 20:07PM
///////////////////////////////////////////////////////////////////////////////


Thank you all of you.

best wishes
-Daniel