Archive: Another Compile Time Question


Another Compile Time Question
I have to go one step further with this. At compile time, I have to find filenames and use them at runtime. It would be horrible to try to hardcode this many files. Is this possible? Here's the code with a bit of pseudo thrown in:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Name "Test"

;Output File Name
OutFile "test.exe"

Section "Install"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Find any dll's to deploy, deploy them, and register them ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

!system 'ECHO ;FileCheck>"%TEMP%\Temp$$$.nsh"'
!system 'IF EXIST "D:\CheckFileTest\Folder1\*.dll" ECHO !define Folder1>>"%TEMP%\Temp$$$.nsh"'
!include "$%TEMP%\Temp$$$.nsh"
!system 'DEL "%TEMP%\Temp$$$.nsh"'

!ifdef Folder1
;;;COMPILE TIME CODE;;;
!system 'dir /B "D:\CheckFileTest\Folder1\*.dll" > myFile.txt'
open myFile.txt
whileNotEndOfFile
$FileName = getLine myFile.txt

;;;RUNTIME CODE;;;
IfFileExists "$INSTDIR\$FileName" 0 new_installation
StrCpy $ALREADY_INSTALLED 1

new_installation:
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED NOREBOOT_NOTPROTECTED $FileName $INSTDIR\$FileName %TEMP%
endWhile
!endif

SectionEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thanks,
Eric


You'll have to write an NSIS program to do it:
http://nsis.sourceforge.net/archive/...instances=0,44

-Stu


I just couldn't come up with how this was going to pass back one filename at a time. I guess I'd have to call one NSIS program to the write the filenames, then call a different program to grab one line at a time and delete that line, until all was gone??? Seems like a lot of work.

But I think I've got an easier way. NSIS is obviously best at runtime stuff. I use NAnt in conjunction with NSIS in all of my builds. So, I'll use NAnt to do the compile time stuff and add code (via NAnt) to the NSIS script to put the "dll deployment" code into the NSIS script. I'll post an example here when I'm done if anyone is interested. Thanks for the help Stu!


To have all features of NSIS run-time: "create single exe and hand needfull parameters by CMDLINE (Call this single exe with !execute)"