Old 23rd August 2006, 02:02   #1
nervous pervous
Registered User
 
Join Date: Aug 2006
Posts: 3
Trouble with specifying file

Is it possible to use absolute file names with the File command? I'm doing the following in the main section of the script:

code:
StrCpy $R0 "$TEMP\Sample"
CreateDirectory "$R0"
SetOutPath "$R0"

File "/oname=\bin\DLLs\mydll.dll" "C:\dev\SomeDirectory\bin\DLLs\mydll.dll"

It compiles fine and I'm pretty sure the files are being found because the exe size is large. However, when I run the setup the files are not extracted. The documentation on this command is very brief, so am I missing some crucial point?

Thanks
nervous pervous is offline   Reply With Quote
Old 23rd August 2006, 02:57   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
This line:
code:

"/oname=\bin\DLLs\mydll.dll"


is not specifying an absolute path, so the file is being extracted, but you don't know where. Specifying an absolute path like:

File "/oname=$R0\bin\DLLs\mydll.dll" "mine.dll"
or
File "/oname=$INSTDIR\bin\DLLs\mydll.dll" "mine.dll"

should extract the file to where you want it.

[edit] Forgot to add the end onto the post.[/edit]

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 23rd August 2006, 03:14   #3
nervous pervous
Registered User
 
Join Date: Aug 2006
Posts: 3
Sorry for the confusion, I meant specifying an absolute path as the source file.

I didn't think I have to specify an absolute path for the destination file. The documentation said that it will create the file as $OUTDIR\$X where /oname=$X. And I am setting the output path correctly.

I tried removing the /oname option and my files are extracted to the Sample directory. So it seems like I am misusing this option. One guess is that the /oname option does not create the directory structure for you, and that I have to create it manually. Can somebody verify if this is true?

I will try your suggestion and simply specify the absolute path for the /oname option as well.

Thanks for the help!
nervous pervous is offline   Reply With Quote
Old 23rd August 2006, 04:27   #4
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
I had to test some of the things to determing the real behavior. Here is how it works:
  • First, /oname means output name. It allows you to specify the output path/file name for a single file rather than having to specify SetOutPath for each file.
  • When using /oname=, The part after the equal sign is the output path/file name. In your first example, you were specifying the output as the relative path. (probably where the confusion started.)
  • /oname option DOES NOT create the directory structure. You'll have to make a call to CreateDirectory first.
  • It's always better to specify an absolute path when extracting, but relatives paths will work find for the source file names.
  • You can use SetOutPath followed by a regular file command to accomplish the same thing the /oname switch. For example, this:
    code:
    File "/oname=C:\temp\foo.exe"

    is exactly the same as this:
    code:
    SetOutPath "C:\temp"
    File "foo.exe"

Personally, I prefer the long way as it gives more control and allows more files to be added to a single directory. Plus, adding more files to the list later is much easier. But either way will work.

Hope this helps clear up the confusion.
Comperio is offline   Reply With Quote
Old 23rd August 2006, 04:59   #5
nervous pervous
Registered User
 
Join Date: Aug 2006
Posts: 3
Thanks! This is exactly the information I needed. I couldn't find this in the docs. Is it available somewhere else? IMHO, this information should be in the documentation, at least the bit about the /oname option not creating the directory structure.
nervous pervous 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