From f44a93685ae651a08b51a2688a1c8d4c9ae2d28e Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 8 May 2009 15:00:25 +0000 Subject: checkin of trunk-copy as base for cmake test git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1716 b956fd51-792f-4845-bead-9b4dfca2ff2c --- cmake/installer/settings/functions.nsh | 199 +++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 cmake/installer/settings/functions.nsh (limited to 'cmake/installer/settings/functions.nsh') diff --git a/cmake/installer/settings/functions.nsh b/cmake/installer/settings/functions.nsh new file mode 100644 index 00000000..bbd4fea2 --- /dev/null +++ b/cmake/installer/settings/functions.nsh @@ -0,0 +1,199 @@ +; Creates Desktop Shortcut(s) if +; checked on Finish Page + +Function CreateDesktopShortCuts + +SetOutPath "$INSTDIR" + +CreateShortcut "$Desktop\$(sm_shortcut).lnk" "$INSTDIR\USdx.exe" + +FunctionEnd + +; Deletes only empty dirs which are +; at the top of the stack. + +Function un.DeleteIfEmpty + FindFirst $R0 $R1 "$0\*.*" + strcmp $R1 "." 0 NoDelete + FindNext $R0 $R1 + strcmp $R1 ".." 0 NoDelete + ClearErrors + FindNext $R0 $R1 + IfErrors 0 NoDelete + FindClose $R0 + Sleep 1000 + RMDir "$0" + NoDelete: + FindClose $R0 +FunctionEnd + +; This is used to write a +; string to config.ini + +Function WriteToConfig + Exch $0 + Exch + Exch $1 + + FileOpen $0 $0 a + FileSeek $0 0 END + FileWrite $0 $1 + FileClose $0 + + Pop $1 + Pop $0 +FunctionEnd + +!macro WriteToConfig String File + Push "${String}" + Push "${File}" + Call WriteToConfig +!macroend +!define WriteToConfig "!insertmacro WriteToConfig" + +; Finds UltraStar Deluxe process +; + +!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess` + +!macro nsProcess::FindProcess _FILE _ERR + nsProcess::_FindProcess /NOUNLOAD `${_FILE}` + Pop ${_ERR} +!macroend + + +!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess` + +!macro nsProcess::KillProcess _FILE _ERR + nsProcess::_KillProcess /NOUNLOAD `${_FILE}` + Pop ${_ERR} +!macroend + + +!define nsProcess::Unload `!insertmacro nsProcess::Unload` + +!macro nsProcess::Unload + nsProcess::_Unload +!macroend + +Function OnCheckbox + GetDlgItem $R0 $HWNDPARENT 1 + Pop $0 # HWND + ${NSD_GetState} $0 $1 + IntCmp $1 1 _Next _Close + _Next: + SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(button_next)" + goto _done + _Close: + SendMessage $R0 ${WM_SETTEXT} 0 "STR:$(button_close)" + _done: +FunctionEnd + +Function VersionCompare + !define VersionCompare `!insertmacro VersionCompareCall` + + !macro VersionCompareCall _VER1 _VER2 _RESULT + Push `${_VER1}` + Push `${_VER2}` + Call VersionCompare + Pop ${_RESULT} + !macroend + + Exch $1 + Exch + Exch $0 + Exch + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + Push $7 + + begin: + StrCpy $2 -1 + IntOp $2 $2 + 1 + StrCpy $3 $0 1 $2 + StrCmp $3 '' +2 + StrCmp $3 '.' 0 -3 + StrCpy $4 $0 $2 + IntOp $2 $2 + 1 + StrCpy $0 $0 '' $2 + + StrCpy $2 -1 + IntOp $2 $2 + 1 + StrCpy $3 $1 1 $2 + StrCmp $3 '' +2 + StrCmp $3 '.' 0 -3 + StrCpy $5 $1 $2 + IntOp $2 $2 + 1 + StrCpy $1 $1 '' $2 + + StrCmp $4$5 '' equal + + StrCpy $6 -1 + IntOp $6 $6 + 1 + StrCpy $3 $4 1 $6 + StrCmp $3 '0' -2 + StrCmp $3 '' 0 +2 + StrCpy $4 0 + + StrCpy $7 -1 + IntOp $7 $7 + 1 + StrCpy $3 $5 1 $7 + StrCmp $3 '0' -2 + StrCmp $3 '' 0 +2 + StrCpy $5 0 + + StrCmp $4 0 0 +2 + StrCmp $5 0 begin newer2 + StrCmp $5 0 newer1 + IntCmp $6 $7 0 newer1 newer2 + + StrCpy $4 '1$4' + StrCpy $5 '1$5' + IntCmp $4 $5 begin newer2 newer1 + + equal: + StrCpy $0 0 + goto end + newer1: + StrCpy $0 1 + goto end + newer2: + StrCpy $0 2 + + end: + Pop $7 + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Exch $0 +FunctionEnd + +Function ReadFileLine +Exch $0 ;file +Exch +Exch $1 ;line number +Push $2 +Push $3 + + FileOpen $2 $0 r + StrCpy $3 0 + +Loop: + IntOp $3 $3 + 1 + ClearErrors + FileRead $2 $0 + IfErrors +2 + StrCmp $3 $1 0 loop + FileClose $2 + +Pop $3 +Pop $2 +Pop $1 +Exch $0 +FunctionEnd \ No newline at end of file -- cgit v1.2.3