Old 23rd April 2004, 13:43   #1
nbroers
Junior Member
 
Join Date: Apr 2004
Posts: 11
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
nbroers is offline   Reply With Quote
Old 23rd April 2004, 13:54   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
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.
Joost Verburg is offline   Reply With Quote
Old 23rd April 2004, 14:01   #3
nbroers
Junior Member
 
Join Date: Apr 2004
Posts: 11
Aaah thanks! Didn't know about the CopyFiles command. Works perfectly.
nbroers is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump