diff options
-rw-r--r-- | build_files/scons/tools/btools.py | 15 | ||||
-rw-r--r-- | release/windows/installer/00.sconsblender.nsi | 9 |
2 files changed, 21 insertions, 3 deletions
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index accdde0d2cf..3131548aed2 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -605,9 +605,12 @@ def NSIS_Installer(target=None, source=None, env=None): doneroot = False rootdirconts = [] datafiles = '' + deldatafiles = '' + deldatadirs = '' l = len(bf_installdir) for dp,dn,df in os.walk(bf_installdir): + # install if not doneroot: for f in df: rootdirconts.append(os.path.join(dp,f)) @@ -621,6 +624,16 @@ def NSIS_Installer(target=None, source=None, env=None): outfile = os.path.join(dp,f) datafiles += ' File '+outfile + "\n" + # uninstall + deldir = dp[l+1:] + + if len(deldir)>0: + deldatadirs = "RMDir $INSTDIR\\" + deldir + "\n" + deldatadirs + deldatadirs = "RMDir /r $INSTDIR\\" + deldir + "\\__pycache__\n" + deldatadirs + + for f in df: + deldatafiles += 'Delete \"$INSTDIR\\' + os.path.join(deldir, f) + "\"\n" + #### change to suit install dir #### inst_dir = install_base_dir + env['BF_INSTALLDIR'] @@ -657,6 +670,8 @@ def NSIS_Installer(target=None, source=None, env=None): ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles) + ns_cnt = string.replace(ns_cnt, "[DELDATAFILES]", deldatafiles) + ns_cnt = string.replace(ns_cnt, "[DELDATADIRS]", deldatadirs) tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi") new_nsis = open(tmpnsi, 'w') diff --git a/release/windows/installer/00.sconsblender.nsi b/release/windows/installer/00.sconsblender.nsi index 42a9b1c13b6..eddd215c64d 100644 --- a/release/windows/installer/00.sconsblender.nsi +++ b/release/windows/installer/00.sconsblender.nsi @@ -205,6 +205,8 @@ Section "Uninstall" ; Remove files [DELROOTDIRCONTS] + [DELDATAFILES] + [DELDATADIRS] Delete "$INSTDIR\uninstall.exe" @@ -212,13 +214,14 @@ Section "Uninstall" RMDir /r "$BLENDERCONFIG\$SHORTVERSION" ${Endif} + ; Remove install directory if it's empty + RMDir $INSTDIR ; Remove shortcuts Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*" Delete "$DESKTOP\Blender.lnk" ; Remove all link related directories and files - RMDir /r "$SMPROGRAMS\Blender Foundation" - ; Clear out installation dir - RMDir /r "$INSTDIR" + RMDir "$SMPROGRAMS\Blender Foundation\Blender" + RMDir "$SMPROGRAMS\Blender Foundation" System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons SectionEnd |