installer.nsi 55 KB

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