installer.nsi 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451
  1. ; Panda3D installation script for the Nullsoft Installation System (NSIS).
  2. ; Jon Parise <[email protected]>
  3. ; with Ben Johnson <[email protected]>
  4. ; with Jason Pratt <[email protected]>
  5. ; mangled by Josh Yelon <[email protected]>
  6. ; Heavily restructured by rdb
  7. ; Caller needs to define these variables:
  8. ;
  9. ; COMPRESSOR - either zlib or lzma
  10. ; TITLE - title (eg. "Panda3D SDK 1.9.0")
  11. ; INSTALLDIR - default install location (eg. "C:\Panda3D-1.9.0-x64")
  12. ; OUTFILE - where to put the output file (eg. "..\nsis-output.exe")
  13. ;
  14. ; BUILT - location of panda install tree.
  15. ; SOURCE - location of the panda source-tree if available, OR location of panda install tree.
  16. ; INCLUDE_PYVER - version of Python that Panda was built with (eg. "3.8", "3.7-32")
  17. ; REGVIEW - either 32 or 64, depending on the build architecture.
  18. ;
  19. Name "${TITLE}"
  20. InstallDir "${INSTALLDIR}"
  21. OutFile "${OUTFILE}"
  22. RequestExecutionLevel user
  23. SetCompress auto
  24. SetCompressor ${COMPRESSOR}
  25. !include "MUI2.nsh"
  26. !include "Sections.nsh"
  27. !include "WinMessages.nsh"
  28. !include "WinVer.nsh"
  29. !include "WordFunc.nsh"
  30. !include "x64.nsh"
  31. !define MUI_WELCOMEFINISHPAGE_BITMAP "panda-install.bmp"
  32. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "panda-install.bmp"
  33. !define MUI_ABORTWARNING
  34. !define MUI_FINISHPAGE_NOREBOOTSUPPORT
  35. !define MUI_FINISHPAGE_RUN
  36. !define MUI_FINISHPAGE_RUN_FUNCTION runFunction
  37. !define MUI_FINISHPAGE_RUN_TEXT "Visit the Panda3D Manual"
  38. !insertmacro MUI_PAGE_WELCOME
  39. !insertmacro MUI_PAGE_LICENSE "${SOURCE}/doc/LICENSE"
  40. !insertmacro MUI_PAGE_DIRECTORY
  41. !ifdef INCLUDE_PYVER
  42. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE ConfirmPythonSelection
  43. !endif
  44. !insertmacro MUI_PAGE_COMPONENTS
  45. !insertmacro MUI_PAGE_INSTFILES
  46. !insertmacro MUI_PAGE_FINISH
  47. !insertmacro MUI_UNPAGE_WELCOME
  48. !insertmacro MUI_UNPAGE_CONFIRM
  49. !insertmacro MUI_UNPAGE_INSTFILES
  50. !insertmacro MUI_UNPAGE_FINISH
  51. !insertmacro MUI_LANGUAGE "English"
  52. ShowInstDetails hide
  53. ShowUninstDetails hide
  54. LicenseData "${SOURCE}/doc/LICENSE"
  55. InstType "Auto (Recommended)"
  56. InstType "Full"
  57. InstType "Light"
  58. LangString DESC_SecCore ${LANG_ENGLISH} "The Panda3D core libraries, configuration files and models/textures that are needed to use Panda3D."
  59. LangString DESC_SecOpenGL ${LANG_ENGLISH} "The OpenGL graphics back-end is the most well-supported renderer."
  60. LangString DESC_SecDirect3D9 ${LANG_ENGLISH} "The optional Direct3D 9 renderer."
  61. LangString DESC_SecOpenAL ${LANG_ENGLISH} "Support for playing audio via the OpenAL library. You need either OpenAL or FMOD to be able to play audio."
  62. LangString DESC_SecFMOD ${LANG_ENGLISH} "Support for decoding and playing audio via the FMOD Ex library. You need either OpenAL or FMOD to be able to play audio."
  63. LangString DESC_SecFFMpeg ${LANG_ENGLISH} "Support for decoding video and audio via the FFMpeg library. Without this option, Panda3D will only be able to play .wav and .ogg audio files."
  64. LangString DESC_SecBullet ${LANG_ENGLISH} "Support for the Bullet physics engine."
  65. LangString DESC_SecODE ${LANG_ENGLISH} "Support for the Open Dynamics Engine to implement physics."
  66. LangString DESC_SecTools ${LANG_ENGLISH} "Useful tools and model converters to help with Panda3D development. Recommended."
  67. LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D."
  68. LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings."
  69. LangString DESC_SecPython ${LANG_ENGLISH} "Contains a ${REGVIEW}-bit copy of Python ${INCLUDE_PYVER} preconfigured to make use of Panda3D."
  70. LangString DESC_SecEnsurePip ${LANG_ENGLISH} "Installs the pip package manager into the included Python installation."
  71. LangString DESC_SecHeadersLibs ${LANG_ENGLISH} "Headers and libraries needed for C++ development with Panda3D."
  72. LangString DESC_SecSamples ${LANG_ENGLISH} "The sample programs demonstrate how to make Python applications with Panda3D."
  73. LangString DESC_SecMaxPlugins ${LANG_ENGLISH} "Plug-ins for Autodesk 3ds Max (${REGVIEW}-bit) that can be used to export models to Panda3D."
  74. LangString DESC_SecMayaPlugins ${LANG_ENGLISH} "Plug-ins and scripts for Autodesk Maya (${REGVIEW}-bit) that can be used to export models to Panda3D."
  75. var READABLE
  76. ; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation
  77. !macro !defineifexist _VAR_NAME _FILE_NAME
  78. !tempfile _TEMPFILE
  79. !ifdef NSIS_WIN32_MAKENSIS
  80. ; Windows - cmd.exe
  81. !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"'
  82. !else
  83. ; Posix - sh
  84. !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi'
  85. !endif
  86. !include '${_TEMPFILE}'
  87. !delfile '${_TEMPFILE}'
  88. !undef _TEMPFILE
  89. !macroend
  90. !insertmacro !defineifexist HAVE_GL "${BUILT}\bin\libpandagl.dll"
  91. !insertmacro !defineifexist HAVE_DX9 "${BUILT}\bin\libpandadx9.dll"
  92. !insertmacro !defineifexist HAVE_OPENAL "${BUILT}\bin\libp3openal_audio.dll"
  93. !insertmacro !defineifexist HAVE_FMOD "${BUILT}\bin\libp3fmod_audio.dll"
  94. !insertmacro !defineifexist HAVE_FFMPEG "${BUILT}\bin\libp3ffmpeg.dll"
  95. !insertmacro !defineifexist HAVE_BULLET "${BUILT}\bin\libpandabullet.dll"
  96. !insertmacro !defineifexist HAVE_ODE "${BUILT}\bin\libpandaode.dll"
  97. !insertmacro !defineifexist HAVE_SAMPLES "${SOURCE}\samples"
  98. !insertmacro !defineifexist HAVE_MAX_PLUGINS "${BUILT}\plugins\*.dlo"
  99. !insertmacro !defineifexist HAVE_MAYA_PLUGINS "${BUILT}\plugins\*.mll"
  100. !macro RemovePythonPath PYVER
  101. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" ""
  102. StrCmp $0 "$INSTDIR" 0 +2
  103. DeleteRegKey HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D"
  104. !macroend
  105. !macro PyBindingSection PYVER EXT_SUFFIX
  106. LangString DESC_SecPyBindings${PYVER} ${LANG_ENGLISH} "Contains the Python modules that allow use of Panda3D using a ${REGVIEW}-bit version of Python ${PYVER}."
  107. !insertmacro !defineifexist _present "${BUILT}\panda3d\core${EXT_SUFFIX}"
  108. !ifdef _present
  109. Section "${PYVER} bindings" SecPyBindings${PYVER}
  110. !if "${PYVER}" == "${INCLUDE_PYVER}"
  111. SectionIn 1 2 3
  112. !else
  113. ; See .onInit function where this is dynamically enabled.
  114. SectionIn 2
  115. !endif
  116. SetDetailsPrint both
  117. DetailPrint "Installing Panda3D bindings for Python ${PYVER}..."
  118. SetDetailsPrint listonly
  119. SetOutPath $INSTDIR\panda3d
  120. File /nonfatal /r "${BUILT}\panda3d\core${EXT_SUFFIX}"
  121. File /nonfatal /r "${BUILT}\panda3d\ai${EXT_SUFFIX}"
  122. File /nonfatal /r "${BUILT}\panda3d\direct${EXT_SUFFIX}"
  123. File /nonfatal /r "${BUILT}\panda3d\egg${EXT_SUFFIX}"
  124. File /nonfatal /r "${BUILT}\panda3d\fx${EXT_SUFFIX}"
  125. File /nonfatal /r "${BUILT}\panda3d\interrogatedb${EXT_SUFFIX}"
  126. File /nonfatal /r "${BUILT}\panda3d\physics${EXT_SUFFIX}"
  127. File /nonfatal /r "${BUILT}\panda3d\_rplight${EXT_SUFFIX}"
  128. File /nonfatal /r "${BUILT}\panda3d\skel${EXT_SUFFIX}"
  129. File /nonfatal /r "${BUILT}\panda3d\vision${EXT_SUFFIX}"
  130. File /nonfatal /r "${BUILT}\panda3d\vrpn${EXT_SUFFIX}"
  131. !ifdef HAVE_BULLET
  132. SectionGetFlags ${SecBullet} $R0
  133. IntOp $R0 $R0 & ${SF_SELECTED}
  134. StrCmp $R0 ${SF_SELECTED} 0 SkipBulletPyd
  135. File /nonfatal /r "${BUILT}\panda3d\bullet${EXT_SUFFIX}"
  136. SkipBulletPyd:
  137. !endif
  138. !ifdef HAVE_ODE
  139. SectionGetFlags ${SecODE} $R0
  140. IntOp $R0 $R0 & ${SF_SELECTED}
  141. StrCmp $R0 ${SF_SELECTED} 0 SkipODEPyd
  142. File /nonfatal /r "${BUILT}\panda3d\ode${EXT_SUFFIX}"
  143. SkipODEPyd:
  144. !endif
  145. SetOutPath $INSTDIR\pandac\input
  146. File /r "${BUILT}\pandac\input\*"
  147. SetOutPath $INSTDIR\Pmw
  148. File /nonfatal /r /x CVS "${BUILT}\Pmw\*"
  149. SetOutPath $INSTDIR\panda3d.dist-info
  150. File /nonfatal /r "${BUILT}\panda3d.dist-info\*"
  151. !ifdef REGVIEW
  152. SetRegView ${REGVIEW}
  153. !endif
  154. ; Install a Panda3D path into the global PythonPath for this version
  155. ; of Python.
  156. WriteRegStr HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" "" "$INSTDIR"
  157. SectionEnd
  158. !undef _present
  159. !endif
  160. !macroend
  161. Function runFunction
  162. ExecShell "open" "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk"
  163. FunctionEnd
  164. SectionGroup "Panda3D Libraries"
  165. Section "Core Libraries" SecCore
  166. SectionIn 1 2 3 RO
  167. SetShellVarContext current
  168. SetOverwrite try
  169. SetDetailsPrint both
  170. DetailPrint "Installing Panda3D libraries..."
  171. SetDetailsPrint listonly
  172. SetOutPath "$INSTDIR"
  173. File /nonfatal "${BUILT}\LICENSE"
  174. File /nonfatal "${BUILT}\ReleaseNotes"
  175. File /nonfatal "${BUILT}\pandaIcon.ico"
  176. SetOutPath $INSTDIR\etc
  177. File /r "${BUILT}\etc\*"
  178. SetOutPath $INSTDIR\bin
  179. File /r /x api-ms-win-*.dll /x ucrtbase.dll /x libpandagl.dll /x libpandadx9.dll /x cgD3D*.dll /x python*.dll /x libpandaode.dll /x libp3fmod_audio.dll /x fmodex*.dll /x libp3ffmpeg.dll /x av*.dll /x postproc*.dll /x swscale*.dll /x swresample*.dll /x NxCharacter*.dll /x cudart*.dll /x PhysX*.dll /x libpandaphysx.dll /x libp3rocket.dll /x boost_python*.dll /x Rocket*.dll /x _rocket*.pyd /x libpandabullet.dll /x OpenAL32.dll /x *_oal.dll /x libp3openal_audio.dll "${BUILT}\bin\*.dll"
  180. File /nonfatal /r "${BUILT}\bin\Microsoft.*.manifest"
  181. ; Before Windows 10, we need these stubs for the UCRT as well.
  182. ReadRegDWORD $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentMajorVersionNumber"
  183. ${If} $0 < 10
  184. ClearErrors
  185. File /nonfatal /r "${BUILT}\bin\api-ms-win-*.dll"
  186. File /nonfatal "${BUILT}\bin\ucrtbase.dll"
  187. ${Endif}
  188. SetDetailsPrint both
  189. DetailPrint "Installing models..."
  190. SetDetailsPrint listonly
  191. SetOutPath $INSTDIR\models
  192. File /nonfatal /r /x CVS "${BUILT}\models\*"
  193. SetDetailsPrint both
  194. DetailPrint "Installing optional components..."
  195. SetDetailsPrint listonly
  196. RMDir /r "$SMPROGRAMS\${TITLE}"
  197. CreateDirectory "$SMPROGRAMS\${TITLE}"
  198. SectionEnd
  199. !ifdef HAVE_GL
  200. Section "OpenGL" SecOpenGL
  201. SectionIn 1 2 3 RO
  202. SetOutPath "$INSTDIR\bin"
  203. File "${BUILT}\bin\libpandagl.dll"
  204. SectionEnd
  205. !endif
  206. !ifdef HAVE_DX9
  207. Section "Direct3D 9" SecDirect3D9
  208. SectionIn 1 2
  209. SetOutPath "$INSTDIR\bin"
  210. File "${BUILT}\bin\libpandadx9.dll"
  211. File /nonfatal /r "${BUILT}\bin\cgD3D9.dll"
  212. SectionEnd
  213. !endif
  214. !ifdef HAVE_OPENAL
  215. Section "OpenAL Audio" SecOpenAL
  216. SectionIn 1 2 3
  217. SetOutPath "$INSTDIR\bin"
  218. File "${BUILT}\bin\libp3openal_audio.dll"
  219. File /nonfatal /r "${BUILT}\bin\OpenAL32.dll"
  220. File /nonfatal /r "${BUILT}\bin\*_oal.dll"
  221. SectionEnd
  222. !endif
  223. !ifdef HAVE_FMOD
  224. Section "FMOD Audio" SecFMOD
  225. SectionIn 1 2
  226. SetOutPath "$INSTDIR\bin"
  227. File "${BUILT}\bin\libp3fmod_audio.dll"
  228. File /r "${BUILT}\bin\fmodex*.dll"
  229. SectionEnd
  230. !endif
  231. !ifdef HAVE_FFMPEG
  232. Section "FFMpeg" SecFFMpeg
  233. SectionIn 1 2
  234. SetOutPath "$INSTDIR\bin"
  235. File "${BUILT}\bin\libp3ffmpeg.dll"
  236. File /nonfatal /r "${BUILT}\bin\av*.dll"
  237. File /nonfatal /r "${BUILT}\bin\swscale*.dll"
  238. File /nonfatal /r "${BUILT}\bin\swresample*.dll"
  239. File /nonfatal /r "${BUILT}\bin\postproc*.dll"
  240. SectionEnd
  241. !endif
  242. !ifdef HAVE_BULLET
  243. Section "Bullet Physics" SecBullet
  244. SectionIn 1 2
  245. SetOutPath "$INSTDIR\bin"
  246. File "${BUILT}\bin\libpandabullet.dll"
  247. SectionEnd
  248. !endif
  249. !ifdef HAVE_ODE
  250. Section "ODE Physics" SecODE
  251. SectionIn 1 2
  252. SetOutPath "$INSTDIR\bin"
  253. File "${BUILT}\bin\libpandaode.dll"
  254. SectionEnd
  255. !endif
  256. SectionGroupEnd
  257. Section "Tools and utilities" SecTools
  258. SectionIn 1 2 3
  259. SetDetailsPrint both
  260. DetailPrint "Installing utilities..."
  261. SetDetailsPrint listonly
  262. SetOutPath "$INSTDIR\bin"
  263. File /r /x deploy-stub.exe /x deploy-stubw.exe "${BUILT}\bin\*.exe"
  264. SetOutPath "$INSTDIR\NSIS"
  265. File /r /x CVS "${NSISDIR}\*"
  266. WriteRegStr HKCU "Software\Classes\Panda3D.Model" "" "Panda3D model/animation"
  267. WriteRegStr HKCU "Software\Classes\Panda3D.Model\DefaultIcon" "" "$INSTDIR\bin\pview.exe"
  268. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell" "" "open"
  269. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"'
  270. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress" "" "Compress to .pz"
  271. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress\command" "" '"$INSTDIR\bin\pzip.exe" "%1"'
  272. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed" "" "Compressed file"
  273. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" "" "$INSTDIR\bin\pzip.exe"
  274. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell" "" "open"
  275. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"'
  276. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress" "" "Decompress"
  277. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress\command" "" '"$INSTDIR\bin\punzip.exe" "%1"'
  278. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile" "" "Panda3D Multifile"
  279. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" "" "$INSTDIR\bin\multify.exe"
  280. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell" "" "open"
  281. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract" "" "Extract here"
  282. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract\command" "" '"$INSTDIR\bin\multify.exe" -xf "%1"'
  283. IfFileExists "$INSTDIR\bin\pstats.exe" 0 SkipPStatsFileAssociation
  284. WriteRegStr HKCU "Software\Classes\Panda3D.PStatsSession" "" "PStats Session"
  285. WriteRegStr HKCU "Software\Classes\Panda3D.PStatsSession\DefaultIcon" "" "%SystemRoot%\system32\imageres.dll,144"
  286. WriteRegStr HKCU "Software\Classes\Panda3D.PStatsSession\shell" "" "open"
  287. WriteRegStr HKCU "Software\Classes\Panda3D.PStatsSession\shell\open\command" "" '"$INSTDIR\bin\pstats.exe" "%1"'
  288. SkipPStatsFileAssociation:
  289. SectionEnd
  290. SectionGroup "Python modules" SecGroupPython
  291. Section "Shared code" SecPyShared
  292. SectionIn 1 2 3
  293. SetDetailsPrint both
  294. DetailPrint "Installing Panda3D shared Python modules..."
  295. SetDetailsPrint listonly
  296. SetOutPath $INSTDIR\direct\directscripts
  297. File /r /x CVS /x Opt?-Win32 "${BUILT}\direct\directscripts\*"
  298. SetOutPath $INSTDIR\direct
  299. File /r /x CVS /x Opt?-Win32 "${BUILT}\direct\*.py"
  300. Delete "$INSTDIR\panda3d.py"
  301. Delete "$INSTDIR\panda3d.pyc"
  302. Delete "$INSTDIR\panda3d.pyo"
  303. SetOutPath $INSTDIR\pandac
  304. File /r "${BUILT}\pandac\*.py"
  305. SetOutPath $INSTDIR\panda3d
  306. File /r "${BUILT}\panda3d\*.py"
  307. SectionEnd
  308. !if "${REGVIEW}" == "32"
  309. !insertmacro PyBindingSection 3.5-32 .cp35-win32.pyd
  310. !insertmacro PyBindingSection 3.6-32 .cp36-win32.pyd
  311. !insertmacro PyBindingSection 3.7-32 .cp37-win32.pyd
  312. !insertmacro PyBindingSection 3.8-32 .cp38-win32.pyd
  313. !insertmacro PyBindingSection 3.9-32 .cp39-win32.pyd
  314. !insertmacro PyBindingSection 3.10-32 .cp310-win32.pyd
  315. !insertmacro PyBindingSection 3.11-32 .cp311-win32.pyd
  316. !insertmacro PyBindingSection 3.12-32 .cp312-win32.pyd
  317. !insertmacro PyBindingSection 3.13-32 .cp313-win32.pyd
  318. !else
  319. !insertmacro PyBindingSection 3.5 .cp35-win_amd64.pyd
  320. !insertmacro PyBindingSection 3.6 .cp36-win_amd64.pyd
  321. !insertmacro PyBindingSection 3.7 .cp37-win_amd64.pyd
  322. !insertmacro PyBindingSection 3.8 .cp38-win_amd64.pyd
  323. !insertmacro PyBindingSection 3.9 .cp39-win_amd64.pyd
  324. !insertmacro PyBindingSection 3.10 .cp310-win_amd64.pyd
  325. !insertmacro PyBindingSection 3.11 .cp311-win_amd64.pyd
  326. !insertmacro PyBindingSection 3.12 .cp312-win_amd64.pyd
  327. !insertmacro PyBindingSection 3.13 .cp313-win_amd64.pyd
  328. !endif
  329. SectionGroupEnd
  330. !ifdef INCLUDE_PYVER
  331. Section "Python ${INCLUDE_PYVER}" SecPython
  332. SectionIn 1 2 3
  333. !ifdef REGVIEW
  334. SetRegView ${REGVIEW}
  335. !endif
  336. SetDetailsPrint both
  337. DetailPrint "Installing Python ${INCLUDE_PYVER} interpreter (${REGVIEW}-bit)..."
  338. SetDetailsPrint listonly
  339. SetOutPath "$INSTDIR\bin"
  340. File /nonfatal "${BUILT}\bin\python*.dll"
  341. SetOutPath "$INSTDIR\python"
  342. File /r /x *.pdb "${BUILT}\python\*"
  343. SetDetailsPrint both
  344. DetailPrint "Adding registry keys for Python..."
  345. SetDetailsPrint listonly
  346. ; Check if a copy of Python is installed for this user.
  347. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  348. StrCmp "$0" "$INSTDIR\python" RegPath 0
  349. StrCmp "$0" "" SkipFileCheck 0
  350. IfFileExists "$0\python.exe" AskRegPath 0
  351. SkipFileCheck:
  352. ; Check if a system-wide copy of Python is installed.
  353. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  354. StrCmp "$0" "$INSTDIR\python" RegPath 0
  355. StrCmp "$0" "" RegPath 0
  356. IfFileExists "$0\python.exe" AskRegPath RegPath
  357. AskRegPath:
  358. IfSilent SkipRegPath
  359. MessageBox MB_YESNO|MB_ICONQUESTION \
  360. "You already have a copy of Python ${INCLUDE_PYVER} installed in:$\r$\n$0$\r$\n$\r$\nPanda3D installs its own copy of Python ${INCLUDE_PYVER}, which will install alongside your existing copy. Would you like to make Panda's copy the default Python for your user account?" \
  361. IDNO SkipRegPath
  362. RegPath:
  363. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "" "$INSTDIR\python"
  364. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "ExecutablePath" "$INSTDIR\python\python.exe"
  365. SkipRegPath:
  366. SectionEnd
  367. Section "Install pip" SecEnsurePip
  368. SectionIn 1 2 3
  369. SetDetailsPrint both
  370. DetailPrint "Installing the pip package manager..."
  371. SetDetailsPrint listonly
  372. SetOutPath $INSTDIR
  373. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m ensurepip --default-pip'
  374. Pop $0
  375. DetailPrint "Command returned exit status $0"
  376. SectionEnd
  377. !endif
  378. !macro MaybeEnablePyBindingSection PYVER
  379. !if "${INCLUDE_PYVER}" != "${PYVER}"
  380. !ifdef SecPyBindings${PYVER}
  381. ; Check if a copy of Python is installed for this user.
  382. Push $0
  383. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  384. StrCmp "$0" "" +2 0
  385. IfFileExists "$0\python.exe" Py${PYVER}Exists 0
  386. ; Check if a system-wide copy of Python is installed.
  387. ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  388. StrCmp "$0" "" Py${PYVER}ExistsNot 0
  389. IfFileExists "$0\python.exe" Py${PYVER}Exists Py${PYVER}ExistsNot
  390. Py${PYVER}Exists:
  391. SectionSetFlags ${SecPyBindings${PYVER}} ${SF_SELECTED}
  392. SectionSetInstTypes ${SecPyBindings${PYVER}} 3
  393. Py${PYVER}ExistsNot:
  394. Pop $0
  395. !endif
  396. !endif
  397. !macroend
  398. Function .onInit
  399. ${If} ${REGVIEW} = 64
  400. ${AndIfNot} ${RunningX64}
  401. MessageBox MB_OK|MB_ICONEXCLAMATION "You are attempting to install the 64-bit version of Panda3D on a 32-bit version of Windows. Please download and install the 32-bit version of Panda3D instead."
  402. Abort
  403. ${EndIf}
  404. !ifdef REGVIEW
  405. SetRegView ${REGVIEW}
  406. !endif
  407. !if "${REGVIEW}" == "32"
  408. !insertmacro MaybeEnablePyBindingSection 3.5-32
  409. !insertmacro MaybeEnablePyBindingSection 3.6-32
  410. !insertmacro MaybeEnablePyBindingSection 3.7-32
  411. !insertmacro MaybeEnablePyBindingSection 3.8-32
  412. ${If} ${AtLeastWin8}
  413. !insertmacro MaybeEnablePyBindingSection 3.9-32
  414. !insertmacro MaybeEnablePyBindingSection 3.10-32
  415. !insertmacro MaybeEnablePyBindingSection 3.11-32
  416. !insertmacro MaybeEnablePyBindingSection 3.12-32
  417. !insertmacro MaybeEnablePyBindingSection 3.13-32
  418. ${EndIf}
  419. !else
  420. !insertmacro MaybeEnablePyBindingSection 3.5
  421. !insertmacro MaybeEnablePyBindingSection 3.6
  422. !insertmacro MaybeEnablePyBindingSection 3.7
  423. !insertmacro MaybeEnablePyBindingSection 3.8
  424. ${If} ${AtLeastWin8}
  425. !insertmacro MaybeEnablePyBindingSection 3.9
  426. !insertmacro MaybeEnablePyBindingSection 3.10
  427. !insertmacro MaybeEnablePyBindingSection 3.11
  428. !insertmacro MaybeEnablePyBindingSection 3.12
  429. !insertmacro MaybeEnablePyBindingSection 3.13
  430. ${EndIf}
  431. !endif
  432. ; These versions of Python require Windows 8.1 or higher.
  433. ${Unless} ${AtLeastWin8}
  434. !ifdef SecPyBindings3.9
  435. SectionSetFlags ${SecPyBindings3.9} ${SF_RO}
  436. SectionSetInstTypes ${SecPyBindings3.9} 0
  437. !endif
  438. !ifdef SecPyBindings3.10
  439. SectionSetFlags ${SecPyBindings3.10} ${SF_RO}
  440. SectionSetInstTypes ${SecPyBindings3.10} 0
  441. !endif
  442. !ifdef SecPyBindings3.11
  443. SectionSetFlags ${SecPyBindings3.11} ${SF_RO}
  444. SectionSetInstTypes ${SecPyBindings3.11} 0
  445. !endif
  446. !ifdef SecPyBindings3.12
  447. SectionSetFlags ${SecPyBindings3.12} ${SF_RO}
  448. SectionSetInstTypes ${SecPyBindings3.12} 0
  449. !endif
  450. !ifdef SecPyBindings3.13
  451. SectionSetFlags ${SecPyBindings3.13} ${SF_RO}
  452. SectionSetInstTypes ${SecPyBindings3.13} 0
  453. !endif
  454. ${EndUnless}
  455. FunctionEnd
  456. Function .onSelChange
  457. ; If someone selects any Python version, the "shared modules" must be on.
  458. ${If} ${SectionIsPartiallySelected} ${SecGroupPython}
  459. SectionGetFlags ${SecPyShared} $R0
  460. IntOp $R0 $R0 | ${SF_SELECTED}
  461. SectionSetFlags ${SecPyShared} $R0
  462. ${EndIf}
  463. !ifdef INCLUDE_PYVER
  464. ${If} ${SectionIsSelected} ${SecPython}
  465. !insertmacro SectionFlagIsSet ${SecEnsurePip} ${SF_RO} 0 SkipSelectEnsurePip
  466. !insertmacro SelectSection ${SecEnsurePip}
  467. SkipSelectEnsurePip:
  468. !insertmacro ClearSectionFlag ${SecEnsurePip} ${SF_RO}
  469. ${Else}
  470. !insertmacro UnselectSection ${SecEnsurePip}
  471. !insertmacro SetSectionFlag ${SecEnsurePip} ${SF_RO}
  472. ${EndIf}
  473. !endif
  474. FunctionEnd
  475. !ifdef INCLUDE_PYVER
  476. Function ConfirmPythonSelection
  477. ; Check the current state of the "Python" section selection.
  478. SectionGetFlags ${SecPython} $R0
  479. IntOp $R1 $R0 & ${SF_SELECTED}
  480. ; Is the "Python" selection deselected?
  481. StrCmp $R1 ${SF_SELECTED} SkipCheck 0
  482. ; Maybe the user just doesn't want Python support at all?
  483. !insertmacro SectionFlagIsSet ${SecGroupPython} ${SF_PSELECTED} 0 SkipCheck
  484. !ifdef REGVIEW
  485. SetRegView ${REGVIEW}
  486. !endif
  487. ; Check for a user installation of Python.
  488. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  489. StrCmp $0 "$INSTDIR\python" CheckSystemWidePython 0
  490. StrCmp $0 "" CheckSystemWidePython 0
  491. IfFileExists "$0\ppython.exe" CheckSystemWidePython 0
  492. IfFileExists "$0\python.exe" SkipCheck CheckSystemWidePython
  493. ; Check for a system-wide Python installation.
  494. CheckSystemWidePython:
  495. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  496. StrCmp $0 "$INSTDIR\python" AskConfirmation 0
  497. StrCmp $0 "" AskConfirmation 0
  498. IfFileExists "$0\ppython.exe" AskConfirmation 0
  499. IfFileExists "$0\python.exe" SkipCheck AskConfirmation
  500. ; No compatible Python version found (that wasn't shipped as part
  501. ; of a different Panda3D build.) Ask the user if he's sure about this.
  502. AskConfirmation:
  503. IfSilent SkipCheck
  504. MessageBox MB_YESNO|MB_ICONQUESTION \
  505. "You do not appear to have a ${REGVIEW}-bit version of Python ${INCLUDE_PYVER} installed. Are you sure you don't want Panda to install a compatible copy of Python?$\r$\n$\r$\nIf you choose Yes, you will not be able to do Python development with Panda3D until you install a ${REGVIEW}-bit version of Python and install the bindings for this version." \
  506. IDYES SkipCheck
  507. ; User clicked no, so re-enable the select box and abort.
  508. IntOp $R0 $R0 | ${SF_SELECTED}
  509. SectionSetFlags ${SecPython} $R0
  510. Abort
  511. SkipCheck:
  512. FunctionEnd
  513. !endif
  514. Section "C++ support" SecHeadersLibs
  515. SectionIn 1 2
  516. SetDetailsPrint both
  517. DetailPrint "Installing header files..."
  518. SetDetailsPrint listonly
  519. SetOutPath $INSTDIR\include
  520. File /r /x *.exp "${BUILT}\include\*"
  521. SetDetailsPrint both
  522. DetailPrint "Installing library archives..."
  523. SetDetailsPrint listonly
  524. SetOutPath $INSTDIR\lib
  525. File /r /x *.exp "${BUILT}\lib\*"
  526. SectionEnd
  527. !ifdef HAVE_SAMPLES
  528. Section "Sample programs" SecSamples
  529. SectionIn 1 2
  530. ; Necessary for proper start menu shortcut installation
  531. SetShellVarContext current
  532. SetDetailsPrint both
  533. DetailPrint "Installing sample programs..."
  534. SetDetailsPrint listonly
  535. SetOutPath $INSTDIR\samples
  536. File /nonfatal /r /x CVS "${SOURCE}\samples\*"
  537. SetDetailsPrint both
  538. DetailPrint "Creating shortcuts..."
  539. SetDetailsPrint listonly
  540. SetOutPath $INSTDIR
  541. WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "https://www.panda3d.org/"
  542. WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}"
  543. WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}/python/more-resources/samples/index"
  544. SetOutPath $INSTDIR
  545. IfFileExists "$INSTDIR\bin\pstats.exe" 0 SkipPStatsShortcut
  546. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Stats Monitor.lnk" "$INSTDIR\bin\pstats.exe" "" "%SystemRoot%\system32\imageres.dll" 144 "" "" "Panda3D Stats Monitor"
  547. SkipPStatsShortcut:
  548. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Manual"
  549. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Website"
  550. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Sample Program Manual"
  551. ${Unless} ${AtLeastWin8}
  552. FindFirst $0 $1 $INSTDIR\samples\*
  553. loop:
  554. StrCmp $1 "" done
  555. StrCmp $1 "." next
  556. StrCmp $1 ".." next
  557. FindFirst $2 $3 $INSTDIR\samples\$1\*.py
  558. StrCmp $3 "" next
  559. Push $1
  560. Push "-"
  561. Push " "
  562. Call StrRep
  563. Call Capitalize
  564. Pop $R0
  565. StrCpy $READABLE $R0
  566. DetailPrint "Creating shortcuts for sample program $READABLE"
  567. CreateDirectory "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE"
  568. SetOutPath $INSTDIR\samples\$1
  569. WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}/python/more-resources/samples/$1"
  570. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Manual Entry on this Sample Program"
  571. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1"
  572. iloop:
  573. StrCmp $3 "" idone
  574. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  575. CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  576. FindNext $2 $3
  577. goto iloop
  578. idone:
  579. next:
  580. FindNext $0 $1
  581. Goto loop
  582. done:
  583. ${EndUnless}
  584. SectionEnd
  585. !endif
  586. !ifdef HAVE_MAX_PLUGINS
  587. Section "3ds Max plug-ins" SecMaxPlugins
  588. SectionIn 1 2
  589. SetDetailsPrint both
  590. DetailPrint "Installing Autodesk 3ds Max plug-ins..."
  591. SetDetailsPrint listonly
  592. SetOutPath $INSTDIR\plugins
  593. File /nonfatal /r "${BUILT}\plugins\*.dle"
  594. File /nonfatal /r "${BUILT}\plugins\*.dlo"
  595. File /nonfatal /r "${BUILT}\plugins\*.ms"
  596. SectionEnd
  597. !endif
  598. !ifdef HAVE_MAYA_PLUGINS
  599. Section "Maya plug-ins" SecMayaPlugins
  600. SectionIn 1 2
  601. SetDetailsPrint both
  602. DetailPrint "Installing Autodesk Maya plug-ins..."
  603. SetDetailsPrint listonly
  604. SetOutPath $INSTDIR\plugins
  605. File /nonfatal /r "${BUILT}\plugins\*.mll"
  606. File /nonfatal /r "${BUILT}\plugins\*.mel"
  607. SectionEnd
  608. !endif
  609. Section -post
  610. !ifdef REGVIEW
  611. SetRegView ${REGVIEW}
  612. !endif
  613. ; Run eggcacher. We can't do this in SecCore because we haven't
  614. ; installed eggcacher at that point yet.
  615. SetDetailsPrint both
  616. DetailPrint "Preloading .egg files into the model cache..."
  617. SetDetailsPrint listonly
  618. SetOutPath $INSTDIR
  619. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m direct.directscripts.eggcacher --concise models samples'
  620. Pop $0
  621. DetailPrint "Command returned exit status $0"
  622. SetDetailsPrint both
  623. DetailPrint "Writing the uninstaller ..."
  624. SetDetailsPrint listonly
  625. Delete "$INSTDIR\uninst.exe"
  626. WriteUninstaller "$INSTDIR\uninst.exe"
  627. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "DisplayName" "${TITLE}"
  628. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "UninstallString" '"$INSTDIR\uninst.exe"'
  629. SetOutPath $INSTDIR
  630. CreateShortcut "$SMPROGRAMS\${TITLE}\Uninstall ${TITLE}.lnk" "$INSTDIR\uninst.exe" ""
  631. SetDetailsPrint both
  632. DetailPrint "Registering file type associations..."
  633. SetDetailsPrint listonly
  634. ; Register various file extensions
  635. WriteRegStr HKCU "Software\Classes\.egg" "" "Panda3D.Model"
  636. WriteRegStr HKCU "Software\Classes\.egg" "Content Type" "application/x-egg"
  637. WriteRegStr HKCU "Software\Classes\.egg" "PerceivedType" "gamemedia"
  638. WriteRegStr HKCU "Software\Classes\.bam" "" "Panda3D.Model"
  639. WriteRegStr HKCU "Software\Classes\.bam" "Content Type" "application/x-bam"
  640. WriteRegStr HKCU "Software\Classes\.bam" "PerceivedType" "gamemedia"
  641. WriteRegStr HKCU "Software\Classes\.pz" "" "Panda3D.Compressed"
  642. WriteRegStr HKCU "Software\Classes\.pz" "PerceivedType" "compressed"
  643. WriteRegStr HKCU "Software\Classes\.mf" "" "Panda3D.Multifile"
  644. WriteRegStr HKCU "Software\Classes\.mf" "PerceivedType" "compressed"
  645. WriteRegStr HKCU "Software\Classes\.prc" "" "inifile"
  646. WriteRegStr HKCU "Software\Classes\.prc" "Content Type" "text/plain"
  647. WriteRegStr HKCU "Software\Classes\.prc" "PerceivedType" "text"
  648. WriteRegStr HKCU "Software\Classes\.pstats" "" "Panda3D.PStatsSession"
  649. WriteRegStr HKCU "Software\Classes\.pstats" "Content Type" "application/vnd.panda3d.pstats"
  650. WriteRegStr HKCU "Software\Classes\.pstats" "PerceivedType" "application"
  651. ; For convenience, if nobody registered .pyd, we will.
  652. ReadRegStr $0 HKCR "Software\Classes\.pyd" ""
  653. StrCmp $0 "" 0 +2
  654. WriteRegStr HKCU "Software\Classes\.pyd" "" "dllfile"
  655. SetDetailsPrint both
  656. DetailPrint "Adding directories to system PATH..."
  657. SetDetailsPrint listonly
  658. # Add the "bin" directory to the PATH.
  659. Push "$INSTDIR\python"
  660. Call RemoveFromPath
  661. Push "$INSTDIR\python\Scripts"
  662. Call RemoveFromPath
  663. Push "$INSTDIR\bin"
  664. Call RemoveFromPath
  665. Push "$INSTDIR\python;$INSTDIR\python\Scripts;$INSTDIR\bin"
  666. Call AddToPath
  667. # This is needed for the environment variable changes to take effect.
  668. DetailPrint "Broadcasting WM_WININICHANGE message..."
  669. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  670. # Now dump the log to disk.
  671. StrCpy $0 "$INSTDIR\install.log"
  672. Push $0
  673. Call DumpLog
  674. SectionEnd
  675. Section Uninstall
  676. SetDetailsPrint listonly
  677. SetShellVarContext current
  678. !ifdef REGVIEW
  679. SetRegView ${REGVIEW}
  680. !endif
  681. SetDetailsPrint both
  682. DetailPrint "Removing registry entries..."
  683. SetDetailsPrint listonly
  684. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  685. DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  686. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Model\DefaultIcon" ""
  687. StrCmp $0 "$INSTDIR\bin\pview.exe" 0 +3
  688. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\DefaultIcon"
  689. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\shell"
  690. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" ""
  691. StrCmp $0 "$INSTDIR\bin\pzip.exe" 0 +3
  692. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon"
  693. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\shell"
  694. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" ""
  695. StrCmp $0 "$INSTDIR\bin\multify.exe" 0 +3
  696. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon"
  697. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\shell"
  698. ReadRegStr $0 HKCU "Software\Classes\Panda3D.PStatsSession\DefaultIcon" ""
  699. StrCmp $0 "$INSTDIR\bin\pstats.exe" 0 +3
  700. DeleteRegKey HKCU "Software\Classes\Panda3D.PStatsSession\DefaultIcon"
  701. DeleteRegKey HKCU "Software\Classes\Panda3D.PStatsSession\shell"
  702. !ifdef INCLUDE_PYVER
  703. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  704. StrCmp $0 "$INSTDIR\python" 0 +2
  705. DeleteRegKey HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}"
  706. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  707. StrCmp $0 "$INSTDIR\python" 0 +2
  708. DeleteRegKey HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}"
  709. !endif
  710. !insertmacro RemovePythonPath 2.7
  711. !if "${REGVIEW}" == "32"
  712. !insertmacro RemovePythonPath 3.5-32
  713. !insertmacro RemovePythonPath 3.6-32
  714. !insertmacro RemovePythonPath 3.7-32
  715. !insertmacro RemovePythonPath 3.8-32
  716. !insertmacro RemovePythonPath 3.9-32
  717. !insertmacro RemovePythonPath 3.10-32
  718. !insertmacro RemovePythonPath 3.11-32
  719. !insertmacro RemovePythonPath 3.12-32
  720. !insertmacro RemovePythonPath 3.13-32
  721. !else
  722. !insertmacro RemovePythonPath 3.5
  723. !insertmacro RemovePythonPath 3.6
  724. !insertmacro RemovePythonPath 3.7
  725. !insertmacro RemovePythonPath 3.8
  726. !insertmacro RemovePythonPath 3.9
  727. !insertmacro RemovePythonPath 3.10
  728. !insertmacro RemovePythonPath 3.11
  729. !insertmacro RemovePythonPath 3.12
  730. !insertmacro RemovePythonPath 3.13
  731. !endif
  732. SetDetailsPrint both
  733. DetailPrint "Deleting files..."
  734. SetDetailsPrint listonly
  735. Delete "$INSTDIR\uninst.exe"
  736. RMDir /r "$INSTDIR"
  737. SetDetailsPrint both
  738. DetailPrint "Removing Start Menu entries..."
  739. SetDetailsPrint listonly
  740. SetShellVarContext current
  741. RMDir /r "$SMPROGRAMS\${TITLE}"
  742. SetShellVarContext all
  743. RMDir /r "$SMPROGRAMS\${TITLE}"
  744. SetDetailsPrint both
  745. DetailPrint "Removing entries from PATH..."
  746. SetDetailsPrint listonly
  747. Push "$INSTDIR\python"
  748. Call un.RemoveFromPath
  749. Push "$INSTDIR\python\Scripts"
  750. Call un.RemoveFromPath
  751. Push "$INSTDIR\bin"
  752. Call un.RemoveFromPath
  753. # This is needed for the environment variable changes to take effect.
  754. DetailPrint "Broadcasting WM_WININICHANGE message..."
  755. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  756. SectionEnd
  757. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  758. !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(DESC_SecCore)
  759. !ifdef HAVE_GL
  760. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenGL} $(DESC_SecOpenGL)
  761. !endif
  762. !ifdef HAVE_DX9
  763. !insertmacro MUI_DESCRIPTION_TEXT ${SecDirect3D9} $(DESC_SecDirect3D9)
  764. !endif
  765. !ifdef HAVE_OPENAL
  766. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenAL} $(DESC_SecOpenAL)
  767. !endif
  768. !ifdef HAVE_FMOD
  769. !insertmacro MUI_DESCRIPTION_TEXT ${SecFMOD} $(DESC_SecFMOD)
  770. !endif
  771. !ifdef HAVE_FFMPEG
  772. !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMpeg} $(DESC_SecFFMpeg)
  773. !endif
  774. !ifdef HAVE_BULLET
  775. !insertmacro MUI_DESCRIPTION_TEXT ${SecBullet} $(DESC_SecBullet)
  776. !endif
  777. !ifdef HAVE_ODE
  778. !insertmacro MUI_DESCRIPTION_TEXT ${SecODE} $(DESC_SecODE)
  779. !endif
  780. !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools)
  781. !insertmacro MUI_DESCRIPTION_TEXT ${SecGroupPython} $(DESC_SecGroupPython)
  782. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyShared} $(DESC_SecPyShared)
  783. !if "${REGVIEW}" == "32"
  784. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5-32} $(DESC_SecPyBindings3.5-32)
  785. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6-32} $(DESC_SecPyBindings3.6-32)
  786. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7-32} $(DESC_SecPyBindings3.7-32)
  787. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8-32} $(DESC_SecPyBindings3.8-32)
  788. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9-32} $(DESC_SecPyBindings3.9-32)
  789. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.10-32} $(DESC_SecPyBindings3.10-32)
  790. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.11-32} $(DESC_SecPyBindings3.11-32)
  791. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.12-32} $(DESC_SecPyBindings3.12-32)
  792. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.13-32} $(DESC_SecPyBindings3.13-32)
  793. !else
  794. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5} $(DESC_SecPyBindings3.5)
  795. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6} $(DESC_SecPyBindings3.6)
  796. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7} $(DESC_SecPyBindings3.7)
  797. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8} $(DESC_SecPyBindings3.8)
  798. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9} $(DESC_SecPyBindings3.9)
  799. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.10} $(DESC_SecPyBindings3.10)
  800. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.11} $(DESC_SecPyBindings3.11)
  801. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.12} $(DESC_SecPyBindings3.12)
  802. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.13} $(DESC_SecPyBindings3.13)
  803. !endif
  804. !ifdef INCLUDE_PYVER
  805. !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython)
  806. !insertmacro MUI_DESCRIPTION_TEXT ${SecEnsurePip} $(DESC_SecEnsurePip)
  807. !endif
  808. !insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs)
  809. !ifdef HAVE_SAMPLES
  810. !insertmacro MUI_DESCRIPTION_TEXT ${SecSamples} $(DESC_SecSamples)
  811. !endif
  812. !ifdef HAVE_MAX_PLUGINS
  813. !insertmacro MUI_DESCRIPTION_TEXT ${SecMaxPlugins} $(DESC_SecMaxPlugins)
  814. !endif
  815. !ifdef HAVE_MAYA_PLUGINS
  816. !insertmacro MUI_DESCRIPTION_TEXT ${SecMayaPlugins} $(DESC_SecMayaPlugins)
  817. !endif
  818. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  819. # --[ Utility Functions ]------------------------------------------------------
  820. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  821. Function IsNT
  822. Push $0
  823. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  824. StrCmp $0 "" 0 IsNT_yes
  825. ; we are not NT.
  826. Pop $0
  827. Push 0
  828. Return
  829. IsNT_yes:
  830. ; NT!!!
  831. Pop $0
  832. Push 1
  833. FunctionEnd
  834. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  835. Function un.IsNT
  836. Push $0
  837. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  838. StrCmp $0 "" 0 unIsNT_yes
  839. ; we are not NT.
  840. Pop $0
  841. Push 0
  842. Return
  843. unIsNT_yes:
  844. ; NT!!!
  845. Pop $0
  846. Push 1
  847. FunctionEnd
  848. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  849. Function StrStr
  850. Push $0
  851. Exch
  852. Pop $0 ; $0 now have the string to find
  853. Push $1
  854. Exch 2
  855. Pop $1 ; $1 now have the string to find in
  856. Exch
  857. Push $2
  858. Push $3
  859. Push $4
  860. Push $5
  861. StrCpy $2 -1
  862. StrLen $3 $0
  863. StrLen $4 $1
  864. IntOp $4 $4 - $3
  865. unStrStr_loop:
  866. IntOp $2 $2 + 1
  867. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  868. StrCpy $5 $1 $3 $2
  869. StrCmp $5 $0 unStrStr_done unStrStr_loop
  870. unStrStrReturn_notFound:
  871. StrCpy $2 -1
  872. unStrStr_done:
  873. Pop $5
  874. Pop $4
  875. Pop $3
  876. Exch $2
  877. Exch 2
  878. Pop $0
  879. Pop $1
  880. FunctionEnd
  881. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  882. Function un.StrStr
  883. Push $0
  884. Exch
  885. Pop $0 ; $0 now have the string to find
  886. Push $1
  887. Exch 2
  888. Pop $1 ; $1 now have the string to find in
  889. Exch
  890. Push $2
  891. Push $3
  892. Push $4
  893. Push $5
  894. StrCpy $2 -1
  895. StrLen $3 $0
  896. StrLen $4 $1
  897. IntOp $4 $4 - $3
  898. unStrStr_loop:
  899. IntOp $2 $2 + 1
  900. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  901. StrCpy $5 $1 $3 $2
  902. StrCmp $5 $0 unStrStr_done unStrStr_loop
  903. unStrStrReturn_notFound:
  904. StrCpy $2 -1
  905. unStrStr_done:
  906. Pop $5
  907. Pop $4
  908. Pop $3
  909. Exch $2
  910. Exch 2
  911. Pop $0
  912. Pop $1
  913. FunctionEnd
  914. ; Capitalizes the first letter of every word.
  915. Function Capitalize
  916. Exch $R0
  917. Push $0
  918. Push $1
  919. Push $2
  920. StrCpy $0 0
  921. capNext:
  922. ; Grab the next character.
  923. StrCpy $1 $R0 1 $0
  924. StrCmp $1 '' end
  925. ; Capitalize it.
  926. ${StrFilter} '$1' '+eng' '' '' $1
  927. ${StrFilter} '$1' '+rus' '' '' $1
  928. ; Splice it into the string.
  929. StrCpy $2 $R0 $0
  930. IntOp $0 $0 + 1
  931. StrCpy $R0 $R0 '' $0
  932. StrCpy $R0 '$2$1$R0'
  933. ; Keep looping through the characters until we find a
  934. ; delimiter or reach the end of the string.
  935. loop:
  936. StrCpy $1 $R0 1 $0
  937. IntOp $0 $0 + 1
  938. StrCmp $1 '' end
  939. StrCmp $1 ' ' capNext
  940. StrCmp $1 '_' capNext
  941. StrCmp $1 '-' capNext
  942. StrCmp $1 '(' capNext
  943. StrCmp $1 '[' capNext
  944. Goto loop
  945. end:
  946. Pop $2
  947. Pop $1
  948. Pop $0
  949. Exch $R0
  950. FunctionEnd
  951. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  952. ; Commentary and smarter ';' checking by Jon Parise <[email protected]>
  953. Function AddToPath
  954. Exch $0
  955. Push $1
  956. Push $2
  957. Push $3
  958. Call IsNT
  959. Pop $1
  960. DetailPrint "Adding to PATH: $0"
  961. StrCmp $1 1 AddToPath_NT
  962. ; We're not on NT, so modify the AUTOEXEC.BAT file.
  963. StrCpy $1 $WINDIR 2
  964. FileOpen $1 "$1\autoexec.bat" a
  965. FileSeek $1 0 END
  966. GetFullPathName /SHORT $0 $0
  967. FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
  968. FileClose $1
  969. Goto AddToPath_done
  970. AddToPath_NT:
  971. ClearErrors
  972. ReadRegStr $1 HKCU "Environment" "PATH"
  973. ; If we reached an error, WATCH OUT. Either this means that
  974. ; the registry key did not exist, or that it didn't fit in
  975. ; NSIS' string limit. If the latter, we have to be very
  976. ; careful not to overwrite the user's PATH.
  977. IfErrors AddToPath_Error
  978. DetailPrint "Current PATH value is set to $1"
  979. StrCmp $1 "" AddToPath_NTAddPath
  980. ; Pull off the last character of the PATH string. If it's a semicolon,
  981. ; we don't need to add another one, so jump to the section where we
  982. ; append the new PATH component(s).
  983. StrCpy $2 $1 1 -1
  984. StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
  985. AddToPath_Error:
  986. DetailPrint "Encountered error reading PATH variable."
  987. ; Does the variable exist? If it doesn't, then the
  988. ; error happened because we need to create the
  989. ; variable. If it does, then we failed to read it
  990. ; because we reached NSIS' string limit.
  991. StrCpy $3 0
  992. AddToPath_loop:
  993. EnumRegValue $4 HKCU "Environment" $3
  994. StrCmp $4 "PATH" AddToPath_ExceedLimit
  995. StrCmp $4 "" AddToPath_NTAddPath
  996. IntOp $3 $3 + 1
  997. Goto AddToPath_loop
  998. AddToPath_ExceedLimit:
  999. MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "Your PATH environment variable is too long! Please remove extraneous entries before proceeding. Panda3D needs to add the following the PATH so that the Panda3D utilities and libraries can be located correctly.$\n$\n$0$\n$\nIf you wish to add Panda3D to the path yourself, choose Ignore." IDIGNORE AddToPath_done IDRETRY AddToPath_NT
  1000. SetDetailsPrint both
  1001. DetailPrint "Cannot append to PATH - variable is likely too long."
  1002. SetDetailsPrint listonly
  1003. Abort
  1004. AddToPath_NTAddSemi:
  1005. StrCpy $1 "$1;"
  1006. Goto AddToPath_NTAddPath
  1007. AddToPath_NTAddPath:
  1008. StrCpy $0 "$1$0"
  1009. WriteRegExpandStr HKCU "Environment" "PATH" $0
  1010. AddToPath_done:
  1011. Pop $3
  1012. Pop $2
  1013. Pop $1
  1014. Pop $0
  1015. FunctionEnd
  1016. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1017. Function RemoveFromPath
  1018. Exch $0
  1019. Push $1
  1020. Push $2
  1021. Push $3
  1022. Push $4
  1023. Push $5
  1024. Call IsNT
  1025. Pop $1
  1026. DetailPrint "Removing from PATH: $0"
  1027. StrCmp $1 1 unRemoveFromPath_NT
  1028. ; Not on NT
  1029. StrCpy $1 $WINDIR 2
  1030. FileOpen $1 "$1\autoexec.bat" r
  1031. GetTempFileName $4
  1032. FileOpen $2 $4 w
  1033. GetFullPathName /SHORT $0 $0
  1034. StrCpy $0 "SET PATH=%PATH%;$0"
  1035. SetRebootFlag true
  1036. Goto unRemoveFromPath_dosLoop
  1037. unRemoveFromPath_dosLoop:
  1038. FileRead $1 $3
  1039. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1040. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1041. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1042. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1043. FileWrite $2 $3
  1044. Goto unRemoveFromPath_dosLoop
  1045. unRemoveFromPath_dosLoopEnd:
  1046. FileClose $2
  1047. FileClose $1
  1048. StrCpy $1 $WINDIR 2
  1049. Delete "$1\autoexec.bat"
  1050. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1051. Delete $4
  1052. Goto unRemoveFromPath_done
  1053. unRemoveFromPath_NT:
  1054. Push $0
  1055. StrLen $2 $0
  1056. ReadRegStr $1 HKCU "Environment" "PATH"
  1057. Push $1
  1058. Push $0
  1059. Call StrStr ; Find $0 in $1
  1060. Pop $0 ; pos of our dir
  1061. IntCmp $0 -1 unRemoveFromPath_NT_System
  1062. ; else, it is in path
  1063. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1064. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1065. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1066. StrLen $0 $1
  1067. StrCpy $1 $1 $0 $2
  1068. StrCpy $3 "$3$1"
  1069. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1070. unRemoveFromPath_NT_System:
  1071. Pop $0
  1072. StrLen $2 $0
  1073. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1074. Push $1
  1075. Push $0
  1076. Call StrStr ; Find $0 in $1
  1077. Pop $0 ; pos of our dir
  1078. IntCmp $0 -1 unRemoveFromPath_done
  1079. ; else, it is in path
  1080. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1081. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1082. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1083. StrLen $0 $1
  1084. StrCpy $1 $1 $0 $2
  1085. StrCpy $3 "$3$1"
  1086. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1087. unRemoveFromPath_done:
  1088. Pop $5
  1089. Pop $4
  1090. Pop $3
  1091. Pop $2
  1092. Pop $1
  1093. Pop $0
  1094. FunctionEnd
  1095. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1096. Function un.RemoveFromPath
  1097. Exch $0
  1098. Push $1
  1099. Push $2
  1100. Push $3
  1101. Push $4
  1102. Push $5
  1103. Call un.IsNT
  1104. Pop $1
  1105. StrCmp $1 1 unRemoveFromPath_NT
  1106. ; Not on NT
  1107. StrCpy $1 $WINDIR 2
  1108. FileOpen $1 "$1\autoexec.bat" r
  1109. GetTempFileName $4
  1110. FileOpen $2 $4 w
  1111. GetFullPathName /SHORT $0 $0
  1112. StrCpy $0 "SET PATH=%PATH%;$0"
  1113. SetRebootFlag true
  1114. Goto unRemoveFromPath_dosLoop
  1115. unRemoveFromPath_dosLoop:
  1116. FileRead $1 $3
  1117. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1118. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1119. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1120. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1121. FileWrite $2 $3
  1122. Goto unRemoveFromPath_dosLoop
  1123. unRemoveFromPath_dosLoopEnd:
  1124. FileClose $2
  1125. FileClose $1
  1126. StrCpy $1 $WINDIR 2
  1127. Delete "$1\autoexec.bat"
  1128. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1129. Delete $4
  1130. Goto unRemoveFromPath_done
  1131. unRemoveFromPath_NT:
  1132. Push $0
  1133. StrLen $2 $0
  1134. ReadRegStr $1 HKCU "Environment" "PATH"
  1135. Push $1
  1136. Push $0
  1137. Call un.StrStr ; Find $0 in $1
  1138. Pop $0 ; pos of our dir
  1139. IntCmp $0 -1 unRemoveFromPath_NT_System
  1140. ; else, it is in path
  1141. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1142. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1143. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1144. StrLen $0 $1
  1145. StrCpy $1 $1 $0 $2
  1146. StrCpy $3 "$3$1"
  1147. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1148. unRemoveFromPath_NT_System:
  1149. Pop $0
  1150. StrLen $2 $0
  1151. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1152. Push $1
  1153. Push $0
  1154. Call un.StrStr ; Find $0 in $1
  1155. Pop $0 ; pos of our dir
  1156. IntCmp $0 -1 unRemoveFromPath_done
  1157. ; else, it is in path
  1158. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1159. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1160. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1161. StrLen $0 $1
  1162. StrCpy $1 $1 $0 $2
  1163. StrCpy $3 "$3$1"
  1164. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1165. unRemoveFromPath_done:
  1166. Pop $5
  1167. Pop $4
  1168. Pop $3
  1169. Pop $2
  1170. Pop $1
  1171. Pop $0
  1172. FunctionEnd
  1173. Function StrRep
  1174. ;Written by dirtydingus 2003-02-20 04:30:09
  1175. ; USAGE
  1176. ;Push String to do replacement in (haystack)
  1177. ;Push String to replace (needle)
  1178. ;Push Replacement
  1179. ;Call StrRep
  1180. ;Pop $R0 result
  1181. ;StrCpy $Result STR $R0
  1182. Exch $R4 ; $R4 = Replacement String
  1183. Exch
  1184. Exch $R3 ; $R3 = String to replace (needle)
  1185. Exch 2
  1186. Exch $R1 ; $R1 = String to do replacement in (haystack)
  1187. Push $R2 ; Replaced haystack
  1188. Push $R5 ; Len (needle)
  1189. Push $R6 ; len (haystack)
  1190. Push $R7 ; Scratch reg
  1191. StrCpy $R2 ""
  1192. StrLen $R5 $R3
  1193. StrLen $R6 $R1
  1194. loop:
  1195. StrCpy $R7 $R1 $R5
  1196. StrCmp $R7 $R3 found
  1197. StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
  1198. StrCpy $R2 "$R2$R7"
  1199. StrCpy $R1 $R1 $R6 1
  1200. StrCmp $R1 "" done loop
  1201. found:
  1202. StrCpy $R2 "$R2$R4"
  1203. StrCpy $R1 $R1 $R6 $R5
  1204. StrCmp $R1 "" done loop
  1205. done:
  1206. StrCpy $R3 $R2
  1207. Pop $R7
  1208. Pop $R6
  1209. Pop $R5
  1210. Pop $R2
  1211. Pop $R1
  1212. Pop $R4
  1213. Exch $R3
  1214. FunctionEnd
  1215. !ifndef LVM_GETITEMCOUNT
  1216. !define LVM_GETITEMCOUNT 0x1004
  1217. !endif
  1218. !ifndef LVM_GETITEMTEXT
  1219. !define LVM_GETITEMTEXT 0x102D
  1220. !endif
  1221. Function DumpLog
  1222. Exch $5
  1223. Push $0
  1224. Push $1
  1225. Push $2
  1226. Push $3
  1227. Push $4
  1228. Push $6
  1229. FindWindow $0 "#32770" "" $HWNDPARENT
  1230. GetDlgItem $0 $0 1016
  1231. StrCmp $0 0 exit
  1232. FileOpen $5 $5 "w"
  1233. StrCmp $5 "" exit
  1234. SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
  1235. System::Alloc ${NSIS_MAX_STRLEN}
  1236. Pop $3
  1237. StrCpy $2 0
  1238. System::Call "*(i, i, i, i, i, i, i, i, i) i \
  1239. (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
  1240. loop: StrCmp $2 $6 done
  1241. System::Call "User32::SendMessageA(i, i, i, i) i \
  1242. ($0, ${LVM_GETITEMTEXT}, $2, r1)"
  1243. System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
  1244. FileWrite $5 "$4$\r$\n"
  1245. IntOp $2 $2 + 1
  1246. Goto loop
  1247. done:
  1248. FileClose $5
  1249. System::Free $1
  1250. System::Free $3
  1251. exit:
  1252. Pop $6
  1253. Pop $4
  1254. Pop $3
  1255. Pop $2
  1256. Pop $1
  1257. Pop $0
  1258. Exch $5
  1259. FunctionEnd