installer.nsi 53 KB

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