Archive: Library.nsh


Library.nsh
In Include/Library.nsh, I see several lines like this:

!include "${NSISDIR}\Bin\LibraryLocal.nsh"
If the user isn't logged in as an Administrator, then this won't work because they won't be able to edit/create files in ${NSISDIR}\Bin\. This is in version 2.10 BTW.

Thanks, fixed.

I've added !tempfile and !delfile, modified LibraryLocal to accept an output file on the command line and updated Library.nsh to use it.

!tempfile uses mkstemp on *nix and !delfile simply uses unlink. They can be used to fix the portability issues in LogicLib.nsh. However, there's still a problem with the quoting in the !system call.


Excellent news, thanks! Should be able to fix the !system quoting in a cross-platform way - IIRC, cmd.exe can use "quoted text", and probably command.com too.


It can use quoted text, but echo itself takes the line as is. Using:

echo "asd"
will output:
"asd"
Even if there's a switch for cmd.exe or command.com to treat the quotes otherwise, how can you call cmd.exe with the switch in a portable method?

Hmm. I see 2 options:

Set an environment variable or registry item to enable the correct quoting on Windows. Not sure if this is available.

Instead of using echo, would it be possible to create file writing functions like !fileopen, !fileread, !filewrite and !fileclose? These would be build-time functions.


I was actually thinking of adding !fileappend and !filereadline while I was at it. But I didn't want to bloat it too much. But I guess I'll add it anyway, unless someone has a better idea for this.


when you add more build functions ...
why not simply remove all and replace them by:
!compiletime
!compiletimeend

every plain nsis code between those lines then will be run immediatly. :D
just an idea ...


That'd require a weird merger between the exehead code and the compiler code. How would you handle defines? How will !ifdef be done? It'd also not work on POSIX because the exehead code is very Windows specific.


hey, this has been more or less a fun posting :D


I've added !appendfile.