Archive: Copying a file on the user's filesystem


Copying a file on the user's filesystem
Hi,

I have added a custom page to allow the user to select the location of a file on his file system. I need to copy this file into INSTDIR.

So I did the following (in the 'pre' function of the custom form):

;Displays the custom page and gets the file path/name and put into Var $licenseFile
;To check that the filename is ok, works fine
MessageBox MB_OK|MB_ICONSTOP "$licenseFile"
;not created yet, so do here now (this works fine)
CreateDirectory "$INSTDIR"
;set $OUTDIR
SetOutPath "$INSTDIR"
SetOverwrite on
;copy the file
File /nonfatal "$licenseFile"

The File command doesn't work here. I had to add the /nonfatal command because the compiler raised a fatal error since the $licenseFile Var contained no value at compiletime. But no file gets copied even though the file path is correct.

What am I doing wrong?

Thanks for any help
Neil


How should the compiler know what file to include if you are using a variable? Use the /oname switch if you want to extract to another location or CopyFiles to copy a file on the user system.


Aaah thanks! :D Didn't know about the CopyFiles command. Works perfectly.