Protected backtrace: don't print all of a very long sourceCode string
[supercollider.git] / platform / windows / supercollider.nsi
blob8b81e688a96cbce98480aee5963d65ada25d7633
1 !cd ${SC_SRC_DIR}
3 !include "Sections.nsh"
4 !include "FileFunc.nsh"
5 !include "WordFunc.nsh"
6 !include "MUI2.nsh"
7 !insertmacro MUI_LANGUAGE "English"
9 !define SC_VERSION "3.5-rc2"
11 Name "SuperCollider ${SC_VERSION}"
12 OutFile ${SC_DST_DIR}\SuperCollider-${SC_VERSION}-win32.exe
13 InstallDir $PROGRAMFILES\SuperCollider-${SC_VERSION}
15 !ifdef SC_ED
16 Var GEDIT_DIR
17 !endif
19 ; --- PAGES ---
21 !define MUI_PAGE_HEADER_TEXT "License"
22 !define MUI_LICENSEPAGE_TEXT_TOP "Please review the license below."
23 !define MUI_LICENSEPAGE_TEXT_BOTTOM \
24 "By installing this software you implicitely agree with this license."
25 !insertmacro MUI_PAGE_LICENSE SuperCollider\COPYING
27 !define MUI_PAGE_HEADER_TEXT "Installation components"
28 !insertmacro MUI_PAGE_COMPONENTS
30 !define MUI_PAGE_HEADER_TEXT "Installation Folder"
31 !insertmacro MUI_PAGE_DIRECTORY
33 !ifdef SC_ED
34 !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Gedit Folder"
35 !define MUI_DIRECTORYPAGE_VARIABLE $GEDIT_DIR
36 !define MUI_PAGE_HEADER_TEXT "Gedit Folder"
37 !define MUI_PAGE_CUSTOMFUNCTION_PRE skipIfNoSced
38 !define MUI_DIRECTORYPAGE_TEXT_TOP \
39 "Setup will install Sced - a plugin for gedit text editor \
40 that allows you to interact with SuperCollider from within the editor, \
41 and adds syntax highlighting for SuperCollider code.$\n$\n\
42 Please select a folder where gedit is installed:"
43 !insertmacro MUI_PAGE_DIRECTORY
44 !endif
46 !insertmacro MUI_PAGE_INSTFILES
48 !insertmacro MUI_UNPAGE_CONFIRM
50 !insertmacro MUI_UNPAGE_INSTFILES
52 ; --- SECTIONS ---
54 Section "Core" core_sect
55 SetOutPath $INSTDIR
56 File /r SuperCollider\*
58 ;Store installation folder
59 ;Does not work!
60 ;WriteRegStr HKLM "Software\SuperCollider\${SC_VERSION}" "intall-dir" $INSTDIR
62 ;Create uninstaller
63 WriteUninstaller "$INSTDIR\Uninstall.exe"
64 SectionEnd
66 !ifdef SC_ED
67 Section "Sced (gedit integration)" sced_sect
68 SetOutPath $GEDIT_DIR
70 File /r gedit\*
72 FileOpen $0 $APPDATA\sced.config.json w
73 IfErrors doneWriteConfig
74 ${WordReplace} $INSTDIR "\" "\\" "+" $1
75 FileWrite $0 "{$\"supercollider-dir$\": $\"$1$\"}"
76 FileClose $0
77 doneWriteConfig:
79 ;WriteRegStr HKLM "SOFTWARE\SuperCollider\${SC_VERSION}" "gedit-dir" "$GEDIT_DIR"
80 SectionEnd
81 !endif
83 Section "Uninstall"
85 RMDir /r "$INSTDIR"
87 ; !ifdef SC_ED
88 ; ReadRegStr $0 HKLM "Software\SuperCollider\${SC_VERSION}" "gedit-dir"
89 ; IfErrors doneDeleteSced
90 ; RMDir /r $0\lib\gedit-2\plugins\sced
91 ; Delete $0\lib\gedit-2\plugins\sced.gedit-plugin
92 ; Delete $0\share\gtksourceview-2.0\language-specs\supercollider.lang
93 ; doneDeleteSced:
94 ; !endif
96 ;DeleteRegKey HKLM "Software\SuperCollider\${SC_VERSION}"
98 SectionEnd
100 ; --- COMPONENT DESCRIPTIONS ---
102 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
103 !insertmacro MUI_DESCRIPTION_TEXT ${core_sect} \
104 "Language interpreter and sound synthesis server. Command-line only."
105 !ifdef SC_ED
106 !insertmacro MUI_DESCRIPTION_TEXT ${sced_sect} \
107 "Integration with gedit text editor.$\n$\n\
108 You need to have gedit installed."
109 !endif
110 !insertmacro MUI_FUNCTION_DESCRIPTION_END
112 ; --- FUNCTIONS ---
114 Function .onInit
115 IntOp $0 ${SF_SELECTED} | ${SF_RO}
116 SectionSetFlags ${core_sect} $0
117 FunctionEnd
119 !ifdef SC_ED
120 Function skipIfNoSced
121 SectionGetFlags ${sced_sect} $0
122 IntOp $0 $0 & ${SF_SELECTED}
123 IntCmp $0 0 is0 ok ok
124 is0:
125 Abort
127 ${Locate} $PROGRAMFILES32 "/G=0 /L=D /M=gedit*" geditFound
128 StrCmp $GEDIT_DIR "" 0 done
129 ${Locate} $PROGRAMFILES64 "/G=0 /L=D /M=gedit*" geditFound
130 done:
131 FunctionEnd
133 Function geditFound
134 StrCpy $GEDIT_DIR $R9
135 Push "StopLocate"
136 FunctionEnd
137 !endif