[英]Saving NSIS Install Log
What's the easiest way to save the install log that is displayed in NSIS? 保存NSIS中显示的安装日志的最简单方法是什么? I seem to remember reading somewhere that you can recompile the NSIS code with a special flag to enable it to save the log.
我似乎记得在某处你可以用特殊标志重新编译NSIS代码以使其能够保存日志。 Is there an easier way?
有更容易的方法吗?
In an attempt to keep file sizes small, the default installation of the NSIS compiler doesn't make log files. 为了保持文件大小较小,NSIS编译器的默认安装不会生成日志文件。 Download the Special Build of a release and copy it over the
makensis.exe
application (and Stub
folder) to patch it to have logging support. 下载一个版本的特殊版本并将其复制到
makensis.exe
应用程序(和Stub
文件夹)上以对其进行修补以获得日志记录支持。
Once you have done that, simply add the following to your script: 完成后,只需将以下内容添加到脚本中:
LogSet on
No other changes are needed. 无需其他更改。 I have no idea why this isn't default as in my cases, it only adds 48 bytes to the filesize!
我不知道为什么这不是默认值,因为在我的情况下,它只增加48个字节到文件大小!
Here's a solution straight from the NSIS website 这是NSIS网站上直接提供的解决方案
StrCpy $0 "$EXEDIR\install.log"
Push $0
Call DumpLog
!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x102D
Function DumpLog
Exch $5
Push $0
Push $1
Push $2
Push $3
Push $4
Push $6
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 exit
FileOpen $5 $5 "w"
StrCmp $5 "" exit
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
System::Alloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageA(i, i, i, i) i \
($0, ${LVM_GETITEMTEXT}, $2, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
FileWrite $5 "$4$\r$\n"
IntOp $2 $2 + 1
Goto loop
done:
FileClose $5
System::Free $1
System::Free $3
exit:
Pop $6
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Exch $5
FunctionEnd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.