[Sugar-devel] [PATCH] Delete activities profile data when uninstall
Sascha Silbe
sascha-ml-ui-sugar-devel at silbe.org
Mon Jul 5 16:19:51 EDT 2010
Excerpts from Martin Abente's message of Mon Jul 05 19:49:10 +0000 2010:
[src/sugar/bundle/activitybundle.py]
> @@ -417,6 +418,10 @@ class ActivityBundle(Bundle):
[...]
> + profile_path = env.get_profile_path(self._bundle_id)
> + if os.path.exists(profile_path):
> + shutil.rmtree(profile_path)
> +
If the directory contains files or directories with mode 000 (unusual, but
possible) or owned by somebody else (e.g. root) this will fail and throw
an exception.
You could use os.walk() + os.chmod() to handle the 000 case, though I'm
unsure whether it's worth the effort. Passing ignore_errors=True to
rmtree() to avoid breaking for any other reason is certainly a good idea,
though. If you want to check whether rmtree() was successful, just check
if profile_path still exists.
Sascha
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100705/8d0d49b6/attachment.pgp
More information about the Sugar-devel
mailing list