kopjekoffie
21st September 2011 09:03 UTC
Please help to make my code better - newbie
Hi,
I am very new to Nsis and this is my first post.
There are very much files I have to copy to the GAC. The files are in a loto of folders and in the subfolders per language a lot of files all end with .DLL.
At the moment I have this code which points to each file separately.
There must be a better way to do this but I don't know how.
This is what I have until now:
File Gacutil.exe
File dlls\nl\MyFile1.resources.dll
nsExec::Exec '"Gacutil.exe" /i "MyFile1.resources.dll'
File dlls\nl\MyFile2.resources.dll
nsExec::Exec '"Gacutil.exe" /i "MyFile2.resources.dll'
File dlls\nl\FileName.resources.dll
nsExec::Exec '"Gacutil.exe" /i "FileName.resources.dll'
File dlls\de\FileNameExample.resources.dll
nsExec::Exec '"Gacutil.exe" /i "FileNameExample.resources.dll'
Please can you help me with improving this?
Thank you very much.
hypheni9
21st September 2011 09:22 UTC
You can put all the .dll files by 1 line of code and then use Exec to load those.
File "dlls\LANGUAGE\*.dll"
Exec "Gacutil.exe" /i "Dll_1"
Exec "Gacutil.exe" /i "Dll_2"
.....
MSG
21st September 2011 09:46 UTC
You can also enumerate the dll files on the development machine at compiletime, and automatically generate code for each file. You'll have to use an external (nsis) exe/vbs script/batch file/whatever to do this, because there are no compiletime commands in NSIS that can do file enumeration.
1) Create an external exe/vbs/etc that generates nsis code depending on what dll files are present at the development machine. If you use an nsis exe, you can let it FindFirst/FindNext to enumerate the dll files, and then FileWrite some NSIS code to an .nsi file.
2) Execute it from your real nsi script using the !system command (see the manual, chapter 5), and after that !include the nsi file generated by this external exe/vbs/etc into your real nsi script.