Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   How to add a string to a variable (http://forums.winamp.com/showthread.php?t=249918)

JoshRountree 28th June 2006 20:18

How to append a string to a variable
 
Ok, I have a default directory that I want to install to. I also have a "directory" page, so that the default directory can be changed if need be.

Regardless of whether or not the default directory is used, I would like to append "\lib\extensions\" to the end of the directory. I am copying an extension to an extension directory, and it's just easier if the user only has to tell me where the installation is.

For instance, if the user picks "C:\blah" , I would like to install to "C:\blah\lib\extensions\myext.jar".

Here's my script

code:

; clockIt.nsi

;--------------------------------

; The name of the installer
Name "ClockIt"

; The file to write
OutFile "ClockItInstall.exe"

; The default installation directory
InstallDir c:\bluej

;--------------------------------

; Pages

Page directory
Page instfiles

;--------------------------------

; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR\lib\extensions

; Put file there
File ClockIt.jar

SectionEnd ; end the section


Joost Verburg 28th June 2006 21:41

StrCpy $MyVar "$MyVar\blah"

JoshRountree 28th June 2006 22:11

That failed to work.

JasonFriday13 28th June 2006 23:45

code:
; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath "$INSTDIR\lib\extensions"

; Put file there
File "ClockIt.jar"

SectionEnd ; end the section

Where possible I always use quotes for path and file names.

JoshRountree 29th June 2006 00:08

That didn't work either...

JasonFriday13 29th June 2006 01:23

So whats the actual problem? I have compiled the script you posted using my own files and it works just fine. You could have a look at the log window at the end of the install and see if the path is actually showing up.

JoshRountree 29th June 2006 01:30

It will compile, but the file only gets copied to the directory chosen, or the default directory.

I need to add "/lib/extensions" onto either the default path, or the path chosen, and then copy my file to that directory.

It's as if
code:
SetOutPath $INSTDIR\lib\extensions
is not getting executed.

Comperio 29th June 2006 02:12

Works for me too...

According to the docs, SetOutPath expects a full pathname. You might want to check to make sure that $INSTDIR is a full path. (Does $INSTDIR have a trailing backslash perhaps?)

Another thing you might check is whether or not SetOutPath generating errors. You can check inserting an "IfErrors" command directly after your SetOutPath statement. (Might also want to check for error after the file command.) Something like this:
code:

IfErrors 0 +2
MessageBox MB_OK "Error in SetOutPath"


JasonFriday13 29th June 2006 02:12

1 Attachment(s)
I don't know what is going on here :hang:, but it should work. I have uploaded an example to this post that contains the source .nsi, ClockIt.txt, and the resulting .exe. I am using NSIS 2.15 for my coding.

[edit]Still works with the trailing backslash in the directory page path.[/edit]

JoshRountree 29th June 2006 02:39

O M G

I feel like such a retard. I don't know why, but when I changed the file above, it worked. Now I can't get it to not work.

I have no clue what I was doing wrong, they all look identical. Could a space somewhere throw things off?


Arggg, I feel stupid.

JasonFriday13 29th June 2006 02:53

There, there, its all right now :o. Stupid little errors do creep in, and this was the simplest one yet. I don't know what you were doing wrong, but it always worked for me :D.


All times are GMT. The time now is 05:18.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.