Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms/sugar-toolkit/bundle-Delete-activities-profile-data-when-uninstall.patch
blob: 0b097c68333577608edd833b5efd60c9804be429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
index c83257f..f6d52ee 100644
--- a/src/sugar/bundle/activitybundle.py
+++ b/src/sugar/bundle/activitybundle.py
@@ -25,6 +25,7 @@ import locale
 import os
 import tempfile
 import logging
+import shutil
 
 from sugar import env
 from sugar import util
@@ -388,7 +389,7 @@ class ActivityBundle(Bundle):
             os.unlink(dst)
         os.symlink(src, dst)
 
-    def uninstall(self, install_path, force=False):
+    def uninstall(self, install_path, force=False, delete_profile=False):
         if os.path.islink(install_path):
             # Don't remove the actual activity dir if it's a symbolic link
             # because we may be removing user data.
@@ -417,6 +418,12 @@ class ActivityBundle(Bundle):
                        os.readlink(path).startswith(install_path):
                         os.remove(path)
 
+        if delete_profile:
+            bundle_profile_path = env.get_profile_path(self._bundle_id)
+            if os.path.exists(bundle_profile_path):
+                os.chmod(bundle_profile_path, 0775)
+                shutil.rmtree(bundle_profile_path, ignore_errors=True)
+
         self._uninstall(install_path)
 
     def is_user_activity(self):
-- 
1.6.0.4