Archive: Copyfiles and Variable trouble


Copyfiles and Variable trouble
Ok, I'm either reading something incorrectly or theres a bug in NSIS somewhere... probably I'm reading it incorrectly...

I have this macro/function thingie, and it produces an error on this line:


CopyFiles "$EXEDIR\Updates\$R1\$R2" "$R0\$R2" "$R3"

And... well I've tried a number of different things. And I can get it to work without the third parameter... but for some reason, with or without quotes, the third parameter doesn't work and it flags a compile error. Any ideas?

Here is the code for the entire macro/function.


Function fCopyAFile

;fType = R1, fName = R2, fSize = R3

Pop $R3
Pop $R2
Pop $R1

StrCpy $R0 "$INSTDIR\Bin"

StrCmp "$R1" "IE" cIsIE
StrCmp "$R1" "XP" cIsNormal
StrCmp "$R1" "2k" cIsNormal

cIsIE:
StrCpy $R0 "$INSTDIR\Bin\IE6"
cIsNormal:

CopyFiles "$EXEDIR\Updates\$R1\$R2" "$R0\$R2" "$R3"
IfErrors "" cEnd

MessageBox MB_RETRYCANCEL "Error copying $EXEDIR\Updates\$R1\$R2! Try again?" IDRETRY cIsNormal
Abort "Could not copy $EXEDIR\Updates\$R1\$R2"
cEnd:

FunctionEnd

!macro CopyAFile fType fName fSize

Push fType
Push fName
Push fSize
Call fCopyAFile

!macroend


I think that's because you aren't using it in a Section (where the "size" parameter is supported). I don't see this information in the documentation either.


Hmm...

a) Just an aside... My macro at the bottom had the actual words in there.. not variables..

b) When I change it to something like:


CopyFiles "$EXEDIR\Updates\$R1\$R2" "$R0\$R2" 1000

It works fine and doesn't complain...


Isn't it supposed to work with variables though?

That bit (1000) is probably set on compile-time only.

-Stu


It is compile time. Use SectionSetSize.