Tolwyn
27th May 2003 17:41 UTC
One file, multiple target directories with different filenames.
I tried to look for this answer.
For reasons that are important to the target audience of the NSIS archive I'm trying to create, I need to have one file, somefile.bmp extracted to multiple folders, AND have unique file names.
somefile.bmp - folder1\thisfile.bmp
- folder2\thatfile.bmp
- folder3\anotherfile.bmp
Is this possible to do?
Afrow UK
27th May 2003 17:45 UTC
Try this script on the archive:
http://nsis.sourceforge.net/archive/...instances=0,11
Should work.
-Stu
Tolwyn
27th May 2003 18:22 UTC
Almost... but...
The file needs to be named something different in each folder.
kichik
27th May 2003 19:08 UTC
You don't need CopyFiles to do this, File /oname will do just fine.
For example:
File /oname=$INSTDIR\folder1\bitmap1.bmp mybitmap.bmp
File /oname=$INSTDIR\folder2\bitmap2.bmp mybitmap.bmp
File /oname=$INSTDIR\folder3\bitmap3.bmp mybitmap.bmp
Tolwyn
27th May 2003 19:15 UTC
I'm confused.
I have "setoutpath" and "file"
Do I use the above example instead?
kichik
27th May 2003 19:18 UTC
You can use /oname with a partial name too, for example:
File /oname=bitmap1.bmp mybitmap.bmp
This will output mybitmap.bmp to $OUTDIR set by SetOutPath, with the name bitmap1.bmp.
Both examples work, the first one doesn't need SetOutPath (unless the directory is not there yet and then you'll have to create it).
Tolwyn
27th May 2003 19:48 UTC
I think I got it, thanks.
I do need the relative path to the source file on my local machine before running the script, right?
I mean, if "mybitmap.bmp" is located on my computer at: c:\foo\mybitmap.bmp, and my NSI script is located in c:\temp\bar.nsi, then:
file /oname=$INSTDIR\folder2\newname1.bmp ..\foo\mybitmap.bmp
file /oname=$INSTDIR\folder2\newname2.bmp ..\foo\mybitmap.bmp
I like that a lot better than the setoutpath, etc.
Right?
kichik
27th May 2003 19:52 UTC
Well, yes, but those are two different things. SetOutPath is for runtime and sets the root directory in which files will be extracted. /oname gives File a filename to use for the extraction, and if it's a not a fully qualified path it adds $OUTDIR that's set by SetOutPath. You can use only /oname if you really want but make sure you don't forget to create the directories because File will not do it for you.
To set the working directory at compile time use !cd.