aboutsummaryrefslogtreecommitdiffstats
path: root/installer/settings/functions.nsh
blob: e8655bc399630775835ca7a06e7ca069c6fa3bcf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
; Creates Desktop Shortcut(s) if 
; checked on Finish Page

Function CreateDesktopShortCuts
SetOutPath "$INSTDIR"
CreateShortcut "$Desktop\$(sm_shortcut).lnk" "$INSTDIR\ultrastardx.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