Short story
Hi all,
Is there a way to travel recursively a directory with NSIS in compilation time?
Thanks
Long story
Hi all,
I'm trying to create an installer with NSIS for a Software I'm developing. The build system we have setup creates a folder with everything you need to run that Software on Windows (dlls, exes, images, libraries, examples, etc). That folder has +400 files and folders. With HM NIS Edit it was possible to generate the sequence of "File" and "SetOutPath" required to install all the content, but is just huge, ugly and if some files are added or removed then we have to change the script manually.
So... we removed the generated sequence of "File" and "SetOutPath" and just added:
File /r "C:\path\to\output\dir"
It works great... but now we have a problem with the uninstaller, because we can't do this:
RMDir /r $INSTDIR
Because is dangerous (as stated here: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.8).
So, we tried to implement the recommendation given there: http://nsis.sourceforge.net/Uninstall_only_installed_files
That solution creates a log on where NSIS writes all the "File" and "SetOutPath" operations made, so it could fallback (remove) on uninstallation. The problem is that the included macros don't support the recursive option of "File".
I've tried to implement a recursive version, by recursively walking on the folder, but I think I'm doing it wrong (well, I'm pretty sure :P):
!include "RecFind.nsh"
Section "Principal" SEC01
${SetOutPath} "$INSTDIR"
SetOverwrite try
${RecFindOpen} "..\executable" $R0 $R1
DetailPrint "Looking into directory: $R0"
${SetOutPath} "$R0"
${RecFindFirst}
DetailPrint "Looking file: $R0\$R1"
${File} "$R0" "$R1"
${RecFindNext}
${RecFindClose}
Using this http://nsis.sourceforge.net/RecFind:_Recursive_FindFirst,_FindNext,_FindClose But I think that only work in installation time.
The solution I've found until now is to create the installer script with a NSIS file used as a template (with some placeholder token for the "File" and "SetOutPath" list), a Python script that walks on the output directory and creates the sequence of "File" and "SetOutPath" required and then writes the final NSIS script... but I really don't like it :S
So my question is:
Is there a way to travel recursively a directory with NSIS in compilation time?
(Or, how can I achieve this with NSIS only?).
Thanks in advance.
Kind regards