Archive: Help with alternate file install


Help with alternate file install
I would like to be able to install one of two jar files (both with the same name, but different versions), based on a condition.

The pseudo code would be:

If( condition = 1 ) then
copy libraryOne.jar library.jar
Else if ( condition = 2 ) then
copy libraryTwo.jar library.jar
End If

I think I want to use FileCopy, but I don't see the ability to designate the destination filename (just the directory).

Thanks,
John


It depends on what you're trying to do. Be more specific on what exactly you want it to do.

Here is an example of an if then type deal. Download HM NIS Edit, It makes sense of all the code and is very helpful.
Get it: http://hmne.sourceforge.net/


ReadRegStr $4 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\UHARC CMD" "UninstallString"
Push $4
Exch $EXEDIR
Exch $EXEDIR
Pop $4
IfFileExists $4 RemoveNew Continue
RemoveOld:
MessageBox MB_ICONINFORMATION|MB_OK "An older version of UHARC CMD has been detected.$\nNow running uninstaller."
goto Remove
RemoveNew:
IfFileExists "$TEMP\version.ini" Yes No
Yes:
Delete "$TEMP\version.ini"
MessageBox MB_ICONINFORMATION|MB_OK "Uninstalling old version.$\n Then updating."
Goto Remove
No:
MessageBox MB_ICONINFORMATION|MB_OK "UHARC CMD 2.0 or newer has been detected.$\nNow running uninstaller."
Goto Remove
Remove:
HideWindow
Exec $4
Goto Start
Continue:


If you're curious where I got that from it is part of the source code from my software UHARC CMD which I freely give the source.
Get it: http://www.pages.drexel.edu/~sag47/uharc

It has a ton of helpful NSIS scripts in it.






What exactly are you trying to do? I can most likely help you.
SAM

Assume that already you've made your conditions:
If( condition = 1 ) then
File /oname=<path_to_extract>\library.jar <local_path>\libraryOne.jar
Else if ( condition = 2 ) then
File /oname=<path_to_extract>\library.jar <local_path>\libraryTwo.jar
End If


I also saw this method of an if/then statement in another thread on this forum.


${If} $R0 == 1
Abort
${EndIf}

@ sag47
what exactly are you talking about on this thread?
You're confusing users, have you seen any need for Abort on the above pseudo code?