- NSIS Discussion
- File /oname and /r?
Archive: File /oname and /r?
Olaf van der Spek
6th November 2004 23:12 UTC
File /oname and /r?
I'd like to include an entire directory, but not any subdirectories and I'd like the files to be put in a directory of the install dir and not in the install dir itself.
How should I do this?
If the /oname=X switch is used, the output name becomes $OUTDIR\X. When using the /oname= switch, only one file can be specified, and the file name can contain variables (or a fully qualified path, e.g. $SYSDIR\whatever.dll).
I'd basically like to use /oname=dir.
A /d for directory, but not recursive would be nice too.
Afrow UK
6th November 2004 23:26 UTC
http://forums.winamp.com/showthread.php?threadid=197671
Please use the search feature of the forums.
-Stu
Olaf van der Spek
6th November 2004 23:32 UTC
Oops. However, that example includes files and subfolders, while I only want to include a folder and it's files, but no subfolders.
Afrow UK
6th November 2004 23:44 UTC
Use "folder\*.*" without the /r switch.
-Stu
Olaf van der Spek
7th November 2004 01:30 UTC
But then the files end up in the install dir, while I want them to be put in a subdir of it.
Afrow UK
7th November 2004 10:49 UTC
SetOutPath "$INSTDIR\subdir"
File "local_folder\*.*"
-Stu
Olaf van der Spek
7th November 2004 11:36 UTC
Thanks.
But a cleaner way would be to be able to do that via /oname=subdir.
Afrow UK
7th November 2004 12:29 UTC
/oname is used for single files only. It specifies the 'output name' for a single file.
-Stu
Olaf van der Spek
7th November 2004 12:41 UTC
Yes, I understand. But why can't it be used (if this feature is implemented) to specify the directory name for multiple files?
Afrow UK
7th November 2004 14:31 UTC
To save 1 line of code? There wouldn't be any point.
You could just make a macro to save 1 line of code like so:
!macro File Outpath File
SetOutPath "${Outpath}"
File "${File}"
!macroend
!define File "!insertmacro File"
Section -blah
${File} "$INSTDIR\subdir" "local_dir\*.*"
SectionEnd
-Stu
Olaf van der Spek
7th November 2004 14:35 UTC
You'd need to restore OutPath too in the macro.
Afrow UK
7th November 2004 14:37 UTC
Originally posted by Olaf van der Spek
You'd need to restore OutPath too in the macro.
Sorry I do not understand what you mean :p
-Stu
Olaf van der Spek
7th November 2004 16:30 UTC
The call to SetOutPath might affect other File calls after this macro call. With /oname=dir, this wouldn't happen, so you'd need to restore the OutPath to what it was before you called the macro (to achieve the same effect as /oname).
Afrow UK
7th November 2004 19:04 UTC
That's why for all files you'd use the macro ;)
Or just another SetOutPath to use for lots of files.
-Stu :o