Skip to content
⌘ NSIS Forum Archive

File /oname and /r?

14 posts

Olaf van der Spek#

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#
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Please use the search feature of the forums.

-Stu
Olaf van der Spek#
Oops. However, that example includes files and subfolders, while I only want to include a folder and it's files, but no subfolders.
Olaf van der Spek#
But then the files end up in the install dir, while I want them to be put in a subdir of it.
Afrow UK#
/oname is used for single files only. It specifies the 'output name' for a single file.

-Stu
Olaf van der Spek#
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#
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
Afrow UK#
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 😛

-Stu
Olaf van der Spek#
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#
That's why for all files you'd use the macro 😉
Or just another SetOutPath to use for lots of files.

-Stu 😳