[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37074] trunk/blender: Fix #27481: windows uninstaller could remove files unrelated to blender
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed Jun 1 15:13:55 CEST 2011
Revision: 37074
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37074
Author: blendix
Date: 2011-06-01 13:13:55 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/build_files/scons/tools/btools.py
trunk/blender/release/windows/installer/00.sconsblender.nsi
Modified: trunk/blender/build_files/scons/tools/btools.py
===================================================================
--- trunk/blender/build_files/scons/tools/btools.py 2011-06-01 13:10:37 UTC (rev 37073)
+++ trunk/blender/build_files/scons/tools/btools.py 2011-06-01 13:13:55 UTC (rev 37074)
@@ -605,9 +605,12 @@
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 @@
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 @@
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')
Modified: trunk/blender/release/windows/installer/00.sconsblender.nsi
===================================================================
--- trunk/blender/release/windows/installer/00.sconsblender.nsi 2011-06-01 13:10:37 UTC (rev 37073)
+++ trunk/blender/release/windows/installer/00.sconsblender.nsi 2011-06-01 13:13:55 UTC (rev 37074)
@@ -205,6 +205,8 @@
; Remove files
[DELROOTDIRCONTS]
+ [DELDATAFILES]
+ [DELDATADIRS]
Delete "$INSTDIR\uninstall.exe"
@@ -212,13 +214,14 @@
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
More information about the Bf-blender-cvs
mailing list