installer.nsi 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522
  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. !insertmacro PyBindingSection 3.13-32 .cp313-win32.pyd
  357. !insertmacro PyBindingSection 3.14-32 .cp314-win32.pyd
  358. !insertmacro PyBindingSection 3.15-32 .cp315-win32.pyd
  359. !else
  360. !insertmacro PyBindingSection 3.5 .cp35-win_amd64.pyd
  361. !insertmacro PyBindingSection 3.6 .cp36-win_amd64.pyd
  362. !insertmacro PyBindingSection 3.7 .cp37-win_amd64.pyd
  363. !insertmacro PyBindingSection 3.8 .cp38-win_amd64.pyd
  364. !insertmacro PyBindingSection 3.9 .cp39-win_amd64.pyd
  365. !insertmacro PyBindingSection 3.10 .cp310-win_amd64.pyd
  366. !insertmacro PyBindingSection 3.11 .cp311-win_amd64.pyd
  367. !insertmacro PyBindingSection 3.12 .cp312-win_amd64.pyd
  368. !insertmacro PyBindingSection 3.13 .cp313-win_amd64.pyd
  369. !insertmacro PyBindingSection 3.14 .cp314-win_amd64.pyd
  370. !insertmacro PyBindingSection 3.15 .cp315-win_amd64.pyd
  371. !endif
  372. SectionGroupEnd
  373. !ifdef INCLUDE_PYVER
  374. Section "Python ${INCLUDE_PYVER}" SecPython
  375. SectionIn 1 2 3
  376. !ifdef REGVIEW
  377. SetRegView ${REGVIEW}
  378. !endif
  379. SetDetailsPrint both
  380. DetailPrint "Installing Python ${INCLUDE_PYVER} interpreter (${REGVIEW}-bit)..."
  381. SetDetailsPrint listonly
  382. SetOutPath "$INSTDIR\bin"
  383. File /nonfatal "${BUILT}\bin\python*.dll"
  384. SetOutPath "$INSTDIR\python"
  385. File /r /x *.pdb "${BUILT}\python\*"
  386. SetDetailsPrint both
  387. DetailPrint "Adding registry keys for Python..."
  388. SetDetailsPrint listonly
  389. ; Check if a copy of Python is installed for this user.
  390. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  391. StrCmp "$0" "$INSTDIR\python" RegPath 0
  392. StrCmp "$0" "" SkipFileCheck 0
  393. IfFileExists "$0\python.exe" AskRegPath 0
  394. SkipFileCheck:
  395. ; Check if a system-wide copy of Python is installed.
  396. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  397. StrCmp "$0" "$INSTDIR\python" RegPath 0
  398. StrCmp "$0" "" RegPath 0
  399. IfFileExists "$0\python.exe" AskRegPath RegPath
  400. AskRegPath:
  401. IfSilent SkipRegPath
  402. MessageBox MB_YESNO|MB_ICONQUESTION \
  403. "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?" \
  404. IDNO SkipRegPath
  405. RegPath:
  406. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "" "$INSTDIR\python"
  407. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "ExecutablePath" "$INSTDIR\python\python.exe"
  408. SkipRegPath:
  409. SectionEnd
  410. Section "Install pip" SecEnsurePip
  411. SectionIn 1 2 3
  412. SetDetailsPrint both
  413. DetailPrint "Installing the pip package manager..."
  414. SetDetailsPrint listonly
  415. SetOutPath $INSTDIR
  416. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m ensurepip --default-pip'
  417. Pop $0
  418. DetailPrint "Command returned exit status $0"
  419. SectionEnd
  420. !endif
  421. !macro MaybeEnablePyBindingSection PYVER
  422. !if "${INCLUDE_PYVER}" != "${PYVER}"
  423. !ifdef SecPyBindings${PYVER}
  424. ; Check if a copy of Python is installed for this user.
  425. Push $0
  426. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  427. StrCmp "$0" "" +2 0
  428. IfFileExists "$0\python.exe" Py${PYVER}Exists 0
  429. ; Check if a system-wide copy of Python is installed.
  430. ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  431. StrCmp "$0" "" Py${PYVER}ExistsNot 0
  432. IfFileExists "$0\python.exe" Py${PYVER}Exists Py${PYVER}ExistsNot
  433. Py${PYVER}Exists:
  434. SectionSetFlags ${SecPyBindings${PYVER}} ${SF_SELECTED}
  435. SectionSetInstTypes ${SecPyBindings${PYVER}} 3
  436. Py${PYVER}ExistsNot:
  437. Pop $0
  438. !endif
  439. !endif
  440. !macroend
  441. Function .onInit
  442. ${If} ${REGVIEW} = 64
  443. ${AndIfNot} ${RunningX64}
  444. 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."
  445. Abort
  446. ${EndIf}
  447. !ifdef REGVIEW
  448. SetRegView ${REGVIEW}
  449. !endif
  450. ; We never check for 2.7; it is always enabled in Auto mode
  451. !if "${REGVIEW}" == "32"
  452. !insertmacro MaybeEnablePyBindingSection 3.5-32
  453. !insertmacro MaybeEnablePyBindingSection 3.6-32
  454. !insertmacro MaybeEnablePyBindingSection 3.7-32
  455. !insertmacro MaybeEnablePyBindingSection 3.8-32
  456. ${If} ${AtLeastWin8}
  457. !insertmacro MaybeEnablePyBindingSection 3.9-32
  458. !insertmacro MaybeEnablePyBindingSection 3.10-32
  459. !insertmacro MaybeEnablePyBindingSection 3.11-32
  460. !insertmacro MaybeEnablePyBindingSection 3.12-32
  461. !insertmacro MaybeEnablePyBindingSection 3.13-32
  462. !insertmacro MaybeEnablePyBindingSection 3.14-32
  463. !insertmacro MaybeEnablePyBindingSection 3.15-32
  464. ${EndIf}
  465. !else
  466. !insertmacro MaybeEnablePyBindingSection 3.5
  467. !insertmacro MaybeEnablePyBindingSection 3.6
  468. !insertmacro MaybeEnablePyBindingSection 3.7
  469. !insertmacro MaybeEnablePyBindingSection 3.8
  470. ${If} ${AtLeastWin8}
  471. !insertmacro MaybeEnablePyBindingSection 3.9
  472. !insertmacro MaybeEnablePyBindingSection 3.10
  473. !insertmacro MaybeEnablePyBindingSection 3.11
  474. !insertmacro MaybeEnablePyBindingSection 3.12
  475. !insertmacro MaybeEnablePyBindingSection 3.13
  476. !insertmacro MaybeEnablePyBindingSection 3.14
  477. !insertmacro MaybeEnablePyBindingSection 3.15
  478. ${EndIf}
  479. !endif
  480. ; These versions of Python require Windows 8.1 or higher.
  481. ${Unless} ${AtLeastWin8}
  482. !ifdef SecPyBindings3.9
  483. SectionSetFlags ${SecPyBindings3.9} ${SF_RO}
  484. SectionSetInstTypes ${SecPyBindings3.9} 0
  485. !endif
  486. !ifdef SecPyBindings3.10
  487. SectionSetFlags ${SecPyBindings3.10} ${SF_RO}
  488. SectionSetInstTypes ${SecPyBindings3.10} 0
  489. !endif
  490. !ifdef SecPyBindings3.11
  491. SectionSetFlags ${SecPyBindings3.11} ${SF_RO}
  492. SectionSetInstTypes ${SecPyBindings3.11} 0
  493. !endif
  494. !ifdef SecPyBindings3.12
  495. SectionSetFlags ${SecPyBindings3.12} ${SF_RO}
  496. SectionSetInstTypes ${SecPyBindings3.12} 0
  497. !endif
  498. !ifdef SecPyBindings3.13
  499. SectionSetFlags ${SecPyBindings3.13} ${SF_RO}
  500. SectionSetInstTypes ${SecPyBindings3.13} 0
  501. !endif
  502. !ifdef SecPyBindings3.14
  503. SectionSetFlags ${SecPyBindings3.14} ${SF_RO}
  504. SectionSetInstTypes ${SecPyBindings3.14} 0
  505. !endif
  506. !ifdef SecPyBindings3.15
  507. SectionSetFlags ${SecPyBindings3.15} ${SF_RO}
  508. SectionSetInstTypes ${SecPyBindings3.15} 0
  509. !endif
  510. ${EndUnless}
  511. FunctionEnd
  512. Function .onSelChange
  513. ; If someone selects any Python version, the "shared modules" must be on.
  514. ${If} ${SectionIsPartiallySelected} ${SecGroupPython}
  515. SectionGetFlags ${SecPyShared} $R0
  516. IntOp $R0 $R0 | ${SF_SELECTED}
  517. SectionSetFlags ${SecPyShared} $R0
  518. ${EndIf}
  519. !ifdef INCLUDE_PYVER
  520. ${If} ${SectionIsSelected} ${SecPython}
  521. !insertmacro SectionFlagIsSet ${SecEnsurePip} ${SF_RO} 0 SkipSelectEnsurePip
  522. !insertmacro SelectSection ${SecEnsurePip}
  523. SkipSelectEnsurePip:
  524. !insertmacro ClearSectionFlag ${SecEnsurePip} ${SF_RO}
  525. ${Else}
  526. !insertmacro UnselectSection ${SecEnsurePip}
  527. !insertmacro SetSectionFlag ${SecEnsurePip} ${SF_RO}
  528. ${EndIf}
  529. !endif
  530. FunctionEnd
  531. !ifdef INCLUDE_PYVER
  532. Function ConfirmPythonSelection
  533. ; Check the current state of the "Python" section selection.
  534. SectionGetFlags ${SecPython} $R0
  535. IntOp $R1 $R0 & ${SF_SELECTED}
  536. ; Is the "Python" selection deselected?
  537. StrCmp $R1 ${SF_SELECTED} SkipCheck 0
  538. ; Maybe the user just doesn't want Python support at all?
  539. !insertmacro SectionFlagIsSet ${SecGroupPython} ${SF_PSELECTED} 0 SkipCheck
  540. !ifdef REGVIEW
  541. SetRegView ${REGVIEW}
  542. !endif
  543. ; Check for a user installation of Python.
  544. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  545. StrCmp $0 "$INSTDIR\python" CheckSystemWidePython 0
  546. StrCmp $0 "" CheckSystemWidePython 0
  547. IfFileExists "$0\ppython.exe" CheckSystemWidePython 0
  548. IfFileExists "$0\python.exe" SkipCheck CheckSystemWidePython
  549. ; Check for a system-wide Python installation.
  550. CheckSystemWidePython:
  551. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  552. StrCmp $0 "$INSTDIR\python" AskConfirmation 0
  553. StrCmp $0 "" AskConfirmation 0
  554. IfFileExists "$0\ppython.exe" AskConfirmation 0
  555. IfFileExists "$0\python.exe" SkipCheck AskConfirmation
  556. ; No compatible Python version found (that wasn't shipped as part
  557. ; of a different Panda3D build.) Ask the user if he's sure about this.
  558. AskConfirmation:
  559. IfSilent SkipCheck
  560. MessageBox MB_YESNO|MB_ICONQUESTION \
  561. "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." \
  562. IDYES SkipCheck
  563. ; User clicked no, so re-enable the select box and abort.
  564. IntOp $R0 $R0 | ${SF_SELECTED}
  565. SectionSetFlags ${SecPython} $R0
  566. Abort
  567. SkipCheck:
  568. FunctionEnd
  569. !endif
  570. Section "C++ support" SecHeadersLibs
  571. SectionIn 1 2
  572. SetDetailsPrint both
  573. DetailPrint "Installing header files..."
  574. SetDetailsPrint listonly
  575. SetOutPath $INSTDIR\include
  576. File /r /x *.exp "${BUILT}\include\*"
  577. SetDetailsPrint both
  578. DetailPrint "Installing library archives..."
  579. SetDetailsPrint listonly
  580. SetOutPath $INSTDIR\lib
  581. File /r /x *.exp "${BUILT}\lib\*"
  582. SectionEnd
  583. !ifdef HAVE_SAMPLES
  584. Section "Sample programs" SecSamples
  585. SectionIn 1 2
  586. ; Necessary for proper start menu shortcut installation
  587. SetShellVarContext current
  588. SetDetailsPrint both
  589. DetailPrint "Installing sample programs..."
  590. SetDetailsPrint listonly
  591. SetOutPath $INSTDIR\samples
  592. File /nonfatal /r /x CVS "${SOURCE}\samples\*"
  593. SetDetailsPrint both
  594. DetailPrint "Creating shortcuts..."
  595. SetDetailsPrint listonly
  596. SetOutPath $INSTDIR
  597. WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "https://www.panda3d.org/"
  598. WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}"
  599. WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}/python/more-resources/samples/index"
  600. SetOutPath $INSTDIR
  601. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Manual"
  602. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Website"
  603. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Sample Program Manual"
  604. ${Unless} ${AtLeastWin8}
  605. FindFirst $0 $1 $INSTDIR\samples\*
  606. loop:
  607. StrCmp $1 "" done
  608. StrCmp $1 "." next
  609. StrCmp $1 ".." next
  610. FindFirst $2 $3 $INSTDIR\samples\$1\*.py
  611. StrCmp $3 "" next
  612. Push $1
  613. Push "-"
  614. Push " "
  615. Call StrRep
  616. Call Capitalize
  617. Pop $R0
  618. StrCpy $READABLE $R0
  619. DetailPrint "Creating shortcuts for sample program $READABLE"
  620. CreateDirectory "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE"
  621. SetOutPath $INSTDIR\samples\$1
  622. WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "https://docs.panda3d.org/${MAJOR_VER}/python/more-resources/samples/$1"
  623. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Manual Entry on this Sample Program"
  624. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1"
  625. iloop:
  626. StrCmp $3 "" idone
  627. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  628. CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  629. FindNext $2 $3
  630. goto iloop
  631. idone:
  632. next:
  633. FindNext $0 $1
  634. Goto loop
  635. done:
  636. ${EndUnless}
  637. SectionEnd
  638. !endif
  639. !ifdef HAVE_MAX_PLUGINS
  640. Section "3ds Max plug-ins" SecMaxPlugins
  641. SectionIn 1 2
  642. SetDetailsPrint both
  643. DetailPrint "Installing Autodesk 3ds Max plug-ins..."
  644. SetDetailsPrint listonly
  645. SetOutPath $INSTDIR\plugins
  646. File /nonfatal /r "${BUILT}\plugins\*.dle"
  647. File /nonfatal /r "${BUILT}\plugins\*.dlo"
  648. File /nonfatal /r "${BUILT}\plugins\*.ms"
  649. SectionEnd
  650. !endif
  651. !ifdef HAVE_MAYA_PLUGINS
  652. Section "Maya plug-ins" SecMayaPlugins
  653. SectionIn 1 2
  654. SetDetailsPrint both
  655. DetailPrint "Installing Autodesk Maya plug-ins..."
  656. SetDetailsPrint listonly
  657. SetOutPath $INSTDIR\plugins
  658. File /nonfatal /r "${BUILT}\plugins\*.mll"
  659. File /nonfatal /r "${BUILT}\plugins\*.mel"
  660. SectionEnd
  661. !endif
  662. Section -post
  663. !ifdef REGVIEW
  664. SetRegView ${REGVIEW}
  665. !endif
  666. ; Run eggcacher. We can't do this in SecCore because we haven't
  667. ; installed eggcacher at that point yet.
  668. SetDetailsPrint both
  669. DetailPrint "Preloading .egg files into the model cache..."
  670. SetDetailsPrint listonly
  671. SetOutPath $INSTDIR
  672. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m direct.directscripts.eggcacher --concise models samples'
  673. Pop $0
  674. DetailPrint "Command returned exit status $0"
  675. SetDetailsPrint both
  676. DetailPrint "Writing the uninstaller ..."
  677. SetDetailsPrint listonly
  678. Delete "$INSTDIR\uninst.exe"
  679. WriteUninstaller "$INSTDIR\uninst.exe"
  680. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "DisplayName" "${TITLE}"
  681. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "UninstallString" '"$INSTDIR\uninst.exe"'
  682. SetOutPath $INSTDIR
  683. CreateShortcut "$SMPROGRAMS\${TITLE}\Uninstall ${TITLE}.lnk" "$INSTDIR\uninst.exe" ""
  684. SetDetailsPrint both
  685. DetailPrint "Registering file type associations..."
  686. SetDetailsPrint listonly
  687. ; Even though we need the runtime to run these, we might as well tell
  688. ; Windows what this kind of file is.
  689. WriteRegStr HKCU "Software\Classes\.p3d" "" "Panda3D applet"
  690. WriteRegStr HKCU "Software\Classes\.p3d" "Content Type" "application/x-panda3d"
  691. WriteRegStr HKCU "Software\Classes\.p3d" "PerceivedType" "application"
  692. ; Register various model files
  693. WriteRegStr HKCU "Software\Classes\.egg" "" "Panda3D.Model"
  694. WriteRegStr HKCU "Software\Classes\.egg" "Content Type" "application/x-egg"
  695. WriteRegStr HKCU "Software\Classes\.egg" "PerceivedType" "gamemedia"
  696. WriteRegStr HKCU "Software\Classes\.bam" "" "Panda3D.Model"
  697. WriteRegStr HKCU "Software\Classes\.bam" "Content Type" "application/x-bam"
  698. WriteRegStr HKCU "Software\Classes\.bam" "PerceivedType" "gamemedia"
  699. WriteRegStr HKCU "Software\Classes\.pz" "" "Panda3D.Compressed"
  700. WriteRegStr HKCU "Software\Classes\.pz" "PerceivedType" "compressed"
  701. WriteRegStr HKCU "Software\Classes\.mf" "" "Panda3D.Multifile"
  702. WriteRegStr HKCU "Software\Classes\.mf" "PerceivedType" "compressed"
  703. WriteRegStr HKCU "Software\Classes\.prc" "" "inifile"
  704. WriteRegStr HKCU "Software\Classes\.prc" "Content Type" "text/plain"
  705. WriteRegStr HKCU "Software\Classes\.prc" "PerceivedType" "text"
  706. ; For convenience, if nobody registered .pyd, we will.
  707. ReadRegStr $0 HKCR "Software\Classes\.pyd" ""
  708. StrCmp $0 "" 0 +2
  709. WriteRegStr HKCU "Software\Classes\.pyd" "" "dllfile"
  710. SetDetailsPrint both
  711. DetailPrint "Adding directories to system PATH..."
  712. SetDetailsPrint listonly
  713. # Add the "bin" directory to the PATH.
  714. Push "$INSTDIR\python"
  715. Call RemoveFromPath
  716. Push "$INSTDIR\python\Scripts"
  717. Call RemoveFromPath
  718. Push "$INSTDIR\bin"
  719. Call RemoveFromPath
  720. Push "$INSTDIR\python;$INSTDIR\python\Scripts;$INSTDIR\bin"
  721. Call AddToPath
  722. # This is needed for the environment variable changes to take effect.
  723. DetailPrint "Broadcasting WM_WININICHANGE message..."
  724. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  725. # Now dump the log to disk.
  726. StrCpy $0 "$INSTDIR\install.log"
  727. Push $0
  728. Call DumpLog
  729. SectionEnd
  730. Section Uninstall
  731. SetDetailsPrint listonly
  732. SetShellVarContext current
  733. !ifdef REGVIEW
  734. SetRegView ${REGVIEW}
  735. !endif
  736. SetDetailsPrint both
  737. DetailPrint "Removing registry entries..."
  738. SetDetailsPrint listonly
  739. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  740. DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  741. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Model\DefaultIcon" ""
  742. StrCmp $0 "$INSTDIR\bin\pview.exe" 0 +3
  743. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\DefaultIcon"
  744. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\shell"
  745. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" ""
  746. StrCmp $0 "$INSTDIR\bin\pzip.exe" 0 +3
  747. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon"
  748. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\shell"
  749. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" ""
  750. StrCmp $0 "$INSTDIR\bin\multify.exe" 0 +3
  751. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon"
  752. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\shell"
  753. !ifdef INCLUDE_PYVER
  754. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  755. StrCmp $0 "$INSTDIR\python" 0 +2
  756. DeleteRegKey HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}"
  757. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  758. StrCmp $0 "$INSTDIR\python" 0 +2
  759. DeleteRegKey HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}"
  760. !endif
  761. !insertmacro RemovePythonPath 2.7
  762. !if "${REGVIEW}" == "32"
  763. !insertmacro RemovePythonPath 3.5-32
  764. !insertmacro RemovePythonPath 3.6-32
  765. !insertmacro RemovePythonPath 3.7-32
  766. !insertmacro RemovePythonPath 3.8-32
  767. !insertmacro RemovePythonPath 3.9-32
  768. !insertmacro RemovePythonPath 3.10-32
  769. !insertmacro RemovePythonPath 3.11-32
  770. !insertmacro RemovePythonPath 3.12-32
  771. !insertmacro RemovePythonPath 3.13-32
  772. !insertmacro RemovePythonPath 3.14-32
  773. !insertmacro RemovePythonPath 3.15-32
  774. !else
  775. !insertmacro RemovePythonPath 3.5
  776. !insertmacro RemovePythonPath 3.6
  777. !insertmacro RemovePythonPath 3.7
  778. !insertmacro RemovePythonPath 3.8
  779. !insertmacro RemovePythonPath 3.9
  780. !insertmacro RemovePythonPath 3.10
  781. !insertmacro RemovePythonPath 3.11
  782. !insertmacro RemovePythonPath 3.12
  783. !insertmacro RemovePythonPath 3.13
  784. !insertmacro RemovePythonPath 3.14
  785. !insertmacro RemovePythonPath 3.15
  786. !endif
  787. SetDetailsPrint both
  788. DetailPrint "Deleting files..."
  789. SetDetailsPrint listonly
  790. Delete "$INSTDIR\uninst.exe"
  791. RMDir /r "$INSTDIR"
  792. SetDetailsPrint both
  793. DetailPrint "Removing Start Menu entries..."
  794. SetDetailsPrint listonly
  795. SetShellVarContext current
  796. RMDir /r "$SMPROGRAMS\${TITLE}"
  797. SetShellVarContext all
  798. RMDir /r "$SMPROGRAMS\${TITLE}"
  799. SetDetailsPrint both
  800. DetailPrint "Removing entries from PATH..."
  801. SetDetailsPrint listonly
  802. Push "$INSTDIR\python"
  803. Call un.RemoveFromPath
  804. Push "$INSTDIR\python\Scripts"
  805. Call un.RemoveFromPath
  806. Push "$INSTDIR\bin"
  807. Call un.RemoveFromPath
  808. # This is needed for the environment variable changes to take effect.
  809. DetailPrint "Broadcasting WM_WININICHANGE message..."
  810. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  811. SectionEnd
  812. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  813. !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(DESC_SecCore)
  814. !ifdef HAVE_GL
  815. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenGL} $(DESC_SecOpenGL)
  816. !endif
  817. !ifdef HAVE_DX9
  818. !insertmacro MUI_DESCRIPTION_TEXT ${SecDirect3D9} $(DESC_SecDirect3D9)
  819. !endif
  820. !ifdef HAVE_OPENAL
  821. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenAL} $(DESC_SecOpenAL)
  822. !endif
  823. !ifdef HAVE_FMOD
  824. !insertmacro MUI_DESCRIPTION_TEXT ${SecFMOD} $(DESC_SecFMOD)
  825. !endif
  826. !ifdef HAVE_FFMPEG
  827. !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMpeg} $(DESC_SecFFMpeg)
  828. !endif
  829. !ifdef HAVE_BULLET
  830. !insertmacro MUI_DESCRIPTION_TEXT ${SecBullet} $(DESC_SecBullet)
  831. !endif
  832. !ifdef HAVE_ODE
  833. !insertmacro MUI_DESCRIPTION_TEXT ${SecODE} $(DESC_SecODE)
  834. !endif
  835. !ifdef HAVE_PHYSX
  836. !insertmacro MUI_DESCRIPTION_TEXT ${SecPhysX} $(DESC_SecPhysX)
  837. !endif
  838. !ifdef HAVE_ROCKET
  839. !insertmacro MUI_DESCRIPTION_TEXT ${SecRocket} $(DESC_SecRocket)
  840. !endif
  841. !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools)
  842. !insertmacro MUI_DESCRIPTION_TEXT ${SecGroupPython} $(DESC_SecGroupPython)
  843. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyShared} $(DESC_SecPyShared)
  844. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings2.7} $(DESC_SecPyBindings2.7)
  845. !if "${REGVIEW}" == "32"
  846. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5-32} $(DESC_SecPyBindings3.5-32)
  847. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6-32} $(DESC_SecPyBindings3.6-32)
  848. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7-32} $(DESC_SecPyBindings3.7-32)
  849. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8-32} $(DESC_SecPyBindings3.8-32)
  850. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9-32} $(DESC_SecPyBindings3.9-32)
  851. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.10-32} $(DESC_SecPyBindings3.10-32)
  852. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.11-32} $(DESC_SecPyBindings3.11-32)
  853. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.12-32} $(DESC_SecPyBindings3.12-32)
  854. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.13-32} $(DESC_SecPyBindings3.13-32)
  855. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.14-32} $(DESC_SecPyBindings3.14-32)
  856. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.15-32} $(DESC_SecPyBindings3.15-32)
  857. !else
  858. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5} $(DESC_SecPyBindings3.5)
  859. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6} $(DESC_SecPyBindings3.6)
  860. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7} $(DESC_SecPyBindings3.7)
  861. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8} $(DESC_SecPyBindings3.8)
  862. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9} $(DESC_SecPyBindings3.9)
  863. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.10} $(DESC_SecPyBindings3.10)
  864. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.11} $(DESC_SecPyBindings3.11)
  865. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.12} $(DESC_SecPyBindings3.12)
  866. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.13} $(DESC_SecPyBindings3.13)
  867. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.14} $(DESC_SecPyBindings3.14)
  868. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.15} $(DESC_SecPyBindings3.15)
  869. !endif
  870. !ifdef INCLUDE_PYVER
  871. !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython)
  872. !insertmacro MUI_DESCRIPTION_TEXT ${SecEnsurePip} $(DESC_SecEnsurePip)
  873. !endif
  874. !insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs)
  875. !ifdef HAVE_SAMPLES
  876. !insertmacro MUI_DESCRIPTION_TEXT ${SecSamples} $(DESC_SecSamples)
  877. !endif
  878. !ifdef HAVE_MAX_PLUGINS
  879. !insertmacro MUI_DESCRIPTION_TEXT ${SecMaxPlugins} $(DESC_SecMaxPlugins)
  880. !endif
  881. !ifdef HAVE_MAYA_PLUGINS
  882. !insertmacro MUI_DESCRIPTION_TEXT ${SecMayaPlugins} $(DESC_SecMayaPlugins)
  883. !endif
  884. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  885. # --[ Utility Functions ]------------------------------------------------------
  886. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  887. Function IsNT
  888. Push $0
  889. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  890. StrCmp $0 "" 0 IsNT_yes
  891. ; we are not NT.
  892. Pop $0
  893. Push 0
  894. Return
  895. IsNT_yes:
  896. ; NT!!!
  897. Pop $0
  898. Push 1
  899. FunctionEnd
  900. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  901. Function un.IsNT
  902. Push $0
  903. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  904. StrCmp $0 "" 0 unIsNT_yes
  905. ; we are not NT.
  906. Pop $0
  907. Push 0
  908. Return
  909. unIsNT_yes:
  910. ; NT!!!
  911. Pop $0
  912. Push 1
  913. FunctionEnd
  914. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  915. Function StrStr
  916. Push $0
  917. Exch
  918. Pop $0 ; $0 now have the string to find
  919. Push $1
  920. Exch 2
  921. Pop $1 ; $1 now have the string to find in
  922. Exch
  923. Push $2
  924. Push $3
  925. Push $4
  926. Push $5
  927. StrCpy $2 -1
  928. StrLen $3 $0
  929. StrLen $4 $1
  930. IntOp $4 $4 - $3
  931. unStrStr_loop:
  932. IntOp $2 $2 + 1
  933. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  934. StrCpy $5 $1 $3 $2
  935. StrCmp $5 $0 unStrStr_done unStrStr_loop
  936. unStrStrReturn_notFound:
  937. StrCpy $2 -1
  938. unStrStr_done:
  939. Pop $5
  940. Pop $4
  941. Pop $3
  942. Exch $2
  943. Exch 2
  944. Pop $0
  945. Pop $1
  946. FunctionEnd
  947. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  948. Function un.StrStr
  949. Push $0
  950. Exch
  951. Pop $0 ; $0 now have the string to find
  952. Push $1
  953. Exch 2
  954. Pop $1 ; $1 now have the string to find in
  955. Exch
  956. Push $2
  957. Push $3
  958. Push $4
  959. Push $5
  960. StrCpy $2 -1
  961. StrLen $3 $0
  962. StrLen $4 $1
  963. IntOp $4 $4 - $3
  964. unStrStr_loop:
  965. IntOp $2 $2 + 1
  966. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  967. StrCpy $5 $1 $3 $2
  968. StrCmp $5 $0 unStrStr_done unStrStr_loop
  969. unStrStrReturn_notFound:
  970. StrCpy $2 -1
  971. unStrStr_done:
  972. Pop $5
  973. Pop $4
  974. Pop $3
  975. Exch $2
  976. Exch 2
  977. Pop $0
  978. Pop $1
  979. FunctionEnd
  980. ; Capitalizes the first letter of every word.
  981. Function Capitalize
  982. Exch $R0
  983. Push $0
  984. Push $1
  985. Push $2
  986. StrCpy $0 0
  987. capNext:
  988. ; Grab the next character.
  989. StrCpy $1 $R0 1 $0
  990. StrCmp $1 '' end
  991. ; Capitalize it.
  992. ${StrFilter} '$1' '+eng' '' '' $1
  993. ${StrFilter} '$1' '+rus' '' '' $1
  994. ; Splice it into the string.
  995. StrCpy $2 $R0 $0
  996. IntOp $0 $0 + 1
  997. StrCpy $R0 $R0 '' $0
  998. StrCpy $R0 '$2$1$R0'
  999. ; Keep looping through the characters until we find a
  1000. ; delimiter or reach the end of the string.
  1001. loop:
  1002. StrCpy $1 $R0 1 $0
  1003. IntOp $0 $0 + 1
  1004. StrCmp $1 '' end
  1005. StrCmp $1 ' ' capNext
  1006. StrCmp $1 '_' capNext
  1007. StrCmp $1 '-' capNext
  1008. StrCmp $1 '(' capNext
  1009. StrCmp $1 '[' capNext
  1010. Goto loop
  1011. end:
  1012. Pop $2
  1013. Pop $1
  1014. Pop $0
  1015. Exch $R0
  1016. FunctionEnd
  1017. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1018. ; Commentary and smarter ';' checking by Jon Parise <[email protected]>
  1019. Function AddToPath
  1020. Exch $0
  1021. Push $1
  1022. Push $2
  1023. Push $3
  1024. Call IsNT
  1025. Pop $1
  1026. DetailPrint "Adding to PATH: $0"
  1027. StrCmp $1 1 AddToPath_NT
  1028. ; We're not on NT, so modify the AUTOEXEC.BAT file.
  1029. StrCpy $1 $WINDIR 2
  1030. FileOpen $1 "$1\autoexec.bat" a
  1031. FileSeek $1 0 END
  1032. GetFullPathName /SHORT $0 $0
  1033. FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
  1034. FileClose $1
  1035. Goto AddToPath_done
  1036. AddToPath_NT:
  1037. ClearErrors
  1038. ReadRegStr $1 HKCU "Environment" "PATH"
  1039. ; If we reached an error, WATCH OUT. Either this means that
  1040. ; the registry key did not exist, or that it didn't fit in
  1041. ; NSIS' string limit. If the latter, we have to be very
  1042. ; careful not to overwrite the user's PATH.
  1043. IfErrors AddToPath_Error
  1044. DetailPrint "Current PATH value is set to $1"
  1045. StrCmp $1 "" AddToPath_NTAddPath
  1046. ; Pull off the last character of the PATH string. If it's a semicolon,
  1047. ; we don't need to add another one, so jump to the section where we
  1048. ; append the new PATH component(s).
  1049. StrCpy $2 $1 1 -1
  1050. StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
  1051. AddToPath_Error:
  1052. DetailPrint "Encountered error reading PATH variable."
  1053. ; Does the variable exist? If it doesn't, then the
  1054. ; error happened because we need to create the
  1055. ; variable. If it does, then we failed to read it
  1056. ; because we reached NSIS' string limit.
  1057. StrCpy $3 0
  1058. AddToPath_loop:
  1059. EnumRegValue $4 HKCU "Environment" $3
  1060. StrCmp $4 "PATH" AddToPath_ExceedLimit
  1061. StrCmp $4 "" AddToPath_NTAddPath
  1062. IntOp $3 $3 + 1
  1063. Goto AddToPath_loop
  1064. AddToPath_ExceedLimit:
  1065. 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
  1066. SetDetailsPrint both
  1067. DetailPrint "Cannot append to PATH - variable is likely too long."
  1068. SetDetailsPrint listonly
  1069. Abort
  1070. AddToPath_NTAddSemi:
  1071. StrCpy $1 "$1;"
  1072. Goto AddToPath_NTAddPath
  1073. AddToPath_NTAddPath:
  1074. StrCpy $0 "$1$0"
  1075. WriteRegExpandStr HKCU "Environment" "PATH" $0
  1076. AddToPath_done:
  1077. Pop $3
  1078. Pop $2
  1079. Pop $1
  1080. Pop $0
  1081. FunctionEnd
  1082. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1083. Function RemoveFromPath
  1084. Exch $0
  1085. Push $1
  1086. Push $2
  1087. Push $3
  1088. Push $4
  1089. Push $5
  1090. Call IsNT
  1091. Pop $1
  1092. DetailPrint "Removing from PATH: $0"
  1093. StrCmp $1 1 unRemoveFromPath_NT
  1094. ; Not on NT
  1095. StrCpy $1 $WINDIR 2
  1096. FileOpen $1 "$1\autoexec.bat" r
  1097. GetTempFileName $4
  1098. FileOpen $2 $4 w
  1099. GetFullPathName /SHORT $0 $0
  1100. StrCpy $0 "SET PATH=%PATH%;$0"
  1101. SetRebootFlag true
  1102. Goto unRemoveFromPath_dosLoop
  1103. unRemoveFromPath_dosLoop:
  1104. FileRead $1 $3
  1105. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1106. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1107. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1108. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1109. FileWrite $2 $3
  1110. Goto unRemoveFromPath_dosLoop
  1111. unRemoveFromPath_dosLoopEnd:
  1112. FileClose $2
  1113. FileClose $1
  1114. StrCpy $1 $WINDIR 2
  1115. Delete "$1\autoexec.bat"
  1116. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1117. Delete $4
  1118. Goto unRemoveFromPath_done
  1119. unRemoveFromPath_NT:
  1120. Push $0
  1121. StrLen $2 $0
  1122. ReadRegStr $1 HKCU "Environment" "PATH"
  1123. Push $1
  1124. Push $0
  1125. Call StrStr ; Find $0 in $1
  1126. Pop $0 ; pos of our dir
  1127. IntCmp $0 -1 unRemoveFromPath_NT_System
  1128. ; else, it is in path
  1129. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1130. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1131. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1132. StrLen $0 $1
  1133. StrCpy $1 $1 $0 $2
  1134. StrCpy $3 "$3$1"
  1135. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1136. unRemoveFromPath_NT_System:
  1137. Pop $0
  1138. StrLen $2 $0
  1139. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1140. Push $1
  1141. Push $0
  1142. Call StrStr ; Find $0 in $1
  1143. Pop $0 ; pos of our dir
  1144. IntCmp $0 -1 unRemoveFromPath_done
  1145. ; else, it is in path
  1146. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1147. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1148. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1149. StrLen $0 $1
  1150. StrCpy $1 $1 $0 $2
  1151. StrCpy $3 "$3$1"
  1152. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1153. unRemoveFromPath_done:
  1154. Pop $5
  1155. Pop $4
  1156. Pop $3
  1157. Pop $2
  1158. Pop $1
  1159. Pop $0
  1160. FunctionEnd
  1161. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1162. Function un.RemoveFromPath
  1163. Exch $0
  1164. Push $1
  1165. Push $2
  1166. Push $3
  1167. Push $4
  1168. Push $5
  1169. Call un.IsNT
  1170. Pop $1
  1171. StrCmp $1 1 unRemoveFromPath_NT
  1172. ; Not on NT
  1173. StrCpy $1 $WINDIR 2
  1174. FileOpen $1 "$1\autoexec.bat" r
  1175. GetTempFileName $4
  1176. FileOpen $2 $4 w
  1177. GetFullPathName /SHORT $0 $0
  1178. StrCpy $0 "SET PATH=%PATH%;$0"
  1179. SetRebootFlag true
  1180. Goto unRemoveFromPath_dosLoop
  1181. unRemoveFromPath_dosLoop:
  1182. FileRead $1 $3
  1183. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1184. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1185. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1186. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1187. FileWrite $2 $3
  1188. Goto unRemoveFromPath_dosLoop
  1189. unRemoveFromPath_dosLoopEnd:
  1190. FileClose $2
  1191. FileClose $1
  1192. StrCpy $1 $WINDIR 2
  1193. Delete "$1\autoexec.bat"
  1194. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1195. Delete $4
  1196. Goto unRemoveFromPath_done
  1197. unRemoveFromPath_NT:
  1198. Push $0
  1199. StrLen $2 $0
  1200. ReadRegStr $1 HKCU "Environment" "PATH"
  1201. Push $1
  1202. Push $0
  1203. Call un.StrStr ; Find $0 in $1
  1204. Pop $0 ; pos of our dir
  1205. IntCmp $0 -1 unRemoveFromPath_NT_System
  1206. ; else, it is in path
  1207. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1208. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1209. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1210. StrLen $0 $1
  1211. StrCpy $1 $1 $0 $2
  1212. StrCpy $3 "$3$1"
  1213. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1214. unRemoveFromPath_NT_System:
  1215. Pop $0
  1216. StrLen $2 $0
  1217. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1218. Push $1
  1219. Push $0
  1220. Call un.StrStr ; Find $0 in $1
  1221. Pop $0 ; pos of our dir
  1222. IntCmp $0 -1 unRemoveFromPath_done
  1223. ; else, it is in path
  1224. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1225. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1226. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1227. StrLen $0 $1
  1228. StrCpy $1 $1 $0 $2
  1229. StrCpy $3 "$3$1"
  1230. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1231. unRemoveFromPath_done:
  1232. Pop $5
  1233. Pop $4
  1234. Pop $3
  1235. Pop $2
  1236. Pop $1
  1237. Pop $0
  1238. FunctionEnd
  1239. Function StrRep
  1240. ;Written by dirtydingus 2003-02-20 04:30:09
  1241. ; USAGE
  1242. ;Push String to do replacement in (haystack)
  1243. ;Push String to replace (needle)
  1244. ;Push Replacement
  1245. ;Call StrRep
  1246. ;Pop $R0 result
  1247. ;StrCpy $Result STR $R0
  1248. Exch $R4 ; $R4 = Replacement String
  1249. Exch
  1250. Exch $R3 ; $R3 = String to replace (needle)
  1251. Exch 2
  1252. Exch $R1 ; $R1 = String to do replacement in (haystack)
  1253. Push $R2 ; Replaced haystack
  1254. Push $R5 ; Len (needle)
  1255. Push $R6 ; len (haystack)
  1256. Push $R7 ; Scratch reg
  1257. StrCpy $R2 ""
  1258. StrLen $R5 $R3
  1259. StrLen $R6 $R1
  1260. loop:
  1261. StrCpy $R7 $R1 $R5
  1262. StrCmp $R7 $R3 found
  1263. StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
  1264. StrCpy $R2 "$R2$R7"
  1265. StrCpy $R1 $R1 $R6 1
  1266. StrCmp $R1 "" done loop
  1267. found:
  1268. StrCpy $R2 "$R2$R4"
  1269. StrCpy $R1 $R1 $R6 $R5
  1270. StrCmp $R1 "" done loop
  1271. done:
  1272. StrCpy $R3 $R2
  1273. Pop $R7
  1274. Pop $R6
  1275. Pop $R5
  1276. Pop $R2
  1277. Pop $R1
  1278. Pop $R4
  1279. Exch $R3
  1280. FunctionEnd
  1281. !ifndef LVM_GETITEMCOUNT
  1282. !define LVM_GETITEMCOUNT 0x1004
  1283. !endif
  1284. !ifndef LVM_GETITEMTEXT
  1285. !define LVM_GETITEMTEXT 0x102D
  1286. !endif
  1287. Function DumpLog
  1288. Exch $5
  1289. Push $0
  1290. Push $1
  1291. Push $2
  1292. Push $3
  1293. Push $4
  1294. Push $6
  1295. FindWindow $0 "#32770" "" $HWNDPARENT
  1296. GetDlgItem $0 $0 1016
  1297. StrCmp $0 0 exit
  1298. FileOpen $5 $5 "w"
  1299. StrCmp $5 "" exit
  1300. SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
  1301. System::Alloc ${NSIS_MAX_STRLEN}
  1302. Pop $3
  1303. StrCpy $2 0
  1304. System::Call "*(i, i, i, i, i, i, i, i, i) i \
  1305. (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
  1306. loop: StrCmp $2 $6 done
  1307. System::Call "User32::SendMessageA(i, i, i, i) i \
  1308. ($0, ${LVM_GETITEMTEXT}, $2, r1)"
  1309. System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
  1310. FileWrite $5 "$4$\r$\n"
  1311. IntOp $2 $2 + 1
  1312. Goto loop
  1313. done:
  1314. FileClose $5
  1315. System::Free $1
  1316. System::Free $3
  1317. exit:
  1318. Pop $6
  1319. Pop $4
  1320. Pop $3
  1321. Pop $2
  1322. Pop $1
  1323. Pop $0
  1324. Exch $5
  1325. FunctionEnd