Implement CR comments for installer text logging

This commit is contained in:
Roxanne Skelly 2018-10-30 12:13:46 -07:00
parent d67598e540
commit 1dc96fec79
3 changed files with 69 additions and 71 deletions

View file

@ -1,68 +0,0 @@
# TextLog.nsh v1.1 - 2005-12-26
# Written by Mike Schinkel [http://www.mikeschinkel.com/blog/]
Var /GLOBAL __TextLog_FileHandle
Var /GLOBAL __TextLog_FileName
Var /GLOBAL __TextLog_State
!define LogMsg '!insertmacro LogMsgCall'
!macro LogMsgCall _text
Call LogSetOn
Push "${_text}"
Call LogText
Call LogSetOff
!macroend
!define LogText '!insertmacro LogTextCall'
!macro LogTextCall _text
Push "${_text}"
Call LogText
!macroend
Function LogText
Exch $0 ; pABC -> 0ABC
FileWrite $__TextLog_FileHandle "$0$\r$\n"
Pop $0 ; 0ABC -> ABC
FunctionEnd
!define LogSetFileName '!insertmacro LogSetFileNameCall'
!macro LogSetFileNameCall _filename
Push "${_filename}"
Call LogSetFileName
!macroend
Function LogSetFileName
Exch $0 ; pABC -> 0ABC
StrCpy $__TextLog_FileName "$0"
StrCmp $__TextLog_State "open" +1 +3
Call LogSetOff
Call LogSetOn
Pop $0 ; 0ABC -> ABC
FunctionEnd
!define LogSetOn '!insertmacro LogSetOnCall'
!macro LogSetOnCall
Call LogSetOn
!macroend
Function LogSetOn
StrCmp $__TextLog_FileName "" +1 AlreadySet
StrCpy $__TextLog_FileName "$INSTDIR\install.log"
AlreadySet:
StrCmp $__TextLog_State "open" +2
FileOpen $__TextLog_FileHandle "$__TextLog_FileName" a
FileSeek $__TextLog_FileHandle 0 END
StrCpy $__TextLog_State "open"
FunctionEnd
!define LogSetOff '!insertmacro LogSetOffCall'
!macro LogSetOffCall
Call LogSetOff
!macroend
Function LogSetOff
StrCmp $__TextLog_State "open" +1 +2
FileClose $__TextLog_FileHandle
StrCpy $__TextLog_State ""
FunctionEnd

View file

@ -54,4 +54,3 @@ set(CLIENT_COMPONENT_CONDITIONAL "@CLIENT_COMPONENT_CONDITIONAL@")
set(INSTALLER_TYPE "@INSTALLER_TYPE@")
set(APP_USER_MODEL_ID "@APP_USER_MODEL_ID@")
set(BYPASS_SIGNING "@BYPASS_SIGNING@")
set(HF_CMAKE_DIR "@HF_CMAKE_DIR@")

View file

@ -30,8 +30,75 @@
;--------------------------------
;Include Installer Logging
!addincludedir "@HF_CMAKE_DIR@\installer"
!include "TextLog.nsh"
; taken from http://nsis.sourceforge.net/Logging:_Simple_Text_File_Logging_Functions_and_Macros
; TextLog.nsh v1.1 - 2005-12-26
; Written by Mike Schinkel [http://www.mikeschinkel.com/blog/]
Var /GLOBAL __TextLog_FileHandle
Var /GLOBAL __TextLog_FileName
Var /GLOBAL __TextLog_State
!define LogMsg '!insertmacro LogMsgCall'
!macro LogMsgCall _text
Call LogSetOn
Push "${_text}"
Call LogText
Call LogSetOff
!macroend
!define LogText '!insertmacro LogTextCall'
!macro LogTextCall _text
Push "${_text}"
Call LogText
!macroend
Function LogText
Exch $0 ; pABC -> 0ABC
FileWrite $__TextLog_FileHandle "$0$\r$\n"
Pop $0 ; 0ABC -> ABC
FunctionEnd
!define LogSetFileName '!insertmacro LogSetFileNameCall'
!macro LogSetFileNameCall _filename
Push "${_filename}"
Call LogSetFileName
!macroend
Function LogSetFileName
Exch $0 ; pABC -> 0ABC
StrCpy $__TextLog_FileName "$0"
StrCmp $__TextLog_State "open" +1 +3
Call LogSetOff
Call LogSetOn
Pop $0 ; 0ABC -> ABC
FunctionEnd
!define LogSetOn '!insertmacro LogSetOnCall'
!macro LogSetOnCall
Call LogSetOn
!macroend
Function LogSetOn
StrCmp $__TextLog_FileName "" +1 AlreadySet
StrCpy $__TextLog_FileName "$INSTDIR\install.log"
AlreadySet:
StrCmp $__TextLog_State "open" +2
FileOpen $__TextLog_FileHandle "$__TextLog_FileName" a
FileSeek $__TextLog_FileHandle 0 END
StrCpy $__TextLog_State "open"
FunctionEnd
!define LogSetOff '!insertmacro LogSetOffCall'
!macro LogSetOffCall
Call LogSetOff
!macroend
Function LogSetOff
StrCmp $__TextLog_State "open" +1 +2
FileClose $__TextLog_FileHandle
StrCpy $__TextLog_State ""
FunctionEnd
;--------------------------------
; Utilities and Functions