diff options
author | Dan Winship <dwinship@redhat.com> | 2007-10-04 18:58:43 (GMT) |
---|---|---|
committer | Dan Winship <dwinship@redhat.com> | 2007-10-04 18:58:43 (GMT) |
commit | b82c9c2c2f872eecd95f802b28b0bdadbb5472ed (patch) | |
tree | 037370aad0116d196e73bb36eb8ccb92c58e9ee0 /sugar/bundle/activitybundle.py | |
parent | 380f3a2275002cfeea905c2478dcf19cc674f1ba (diff) |
Reorganize the uninstall code for #3151
(Make it so you can build a Bundle object from the zip file but still use
its uninstall() method to uninstall the unzipped version.)
Diffstat (limited to 'sugar/bundle/activitybundle.py')
-rw-r--r-- | sugar/bundle/activitybundle.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sugar/bundle/activitybundle.py b/sugar/bundle/activitybundle.py index f77bdb7..d13f93c 100644 --- a/sugar/bundle/activitybundle.py +++ b/sugar/bundle/activitybundle.py @@ -252,8 +252,13 @@ class ActivityBundle(Bundle): raise RegistrationException def uninstall(self): - if not self.is_installed(): - raise NotInstalledException + if self._unpacked: + install_path = self._path + else: + if not self.is_installed(): + raise NotInstalledException + install_path = os.path.join(env.get_user_activities_path(), + self._zip_root_dir) xdg_data_home = os.getenv('XDG_DATA_HOME', os.path.expanduser('~/.local/share')) @@ -271,10 +276,10 @@ class ActivityBundle(Bundle): for file in os.listdir(installed_icons_dir): path = os.path.join(installed_icons_dir, file) if os.path.islink(path) and \ - os.readlink(path).startswith(self._path): + os.readlink(path).startswith(install_path): os.remove(path) - self._uninstall() + self._uninstall(install_path) # FIXME: notify shell |