installer.nsi 56 KB

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