diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-06-01 17:13:55 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-06-01 17:13:55 +0400 |
commit | 7b4aac3e347982aa98a616d18c22a3d2eddc14d2 (patch) | |
tree | be1bfbacc80e62db93695c88c17e923dce1cbcb7 /build_files | |
parent | a180bfe26784a3be35476c4974f739c0baa28769 (diff) |
Fix #27481: windows uninstaller could remove files unrelated to blender
when installing to a folder that already existed. Now the uninstaller
will remove only the files it has installed, and leave any other files
in the installation directory intact.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/scons/tools/btools.py | 15 |
1 files changed, 15 insertions, 0 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') |