diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py
index 268576e..2bec54f 100644
a
|
b
|
class ActivityBundle(Bundle): |
323 | 323 | os.makedirs(mime_pkg_dir) |
324 | 324 | installed_mime_path = os.path.join(mime_pkg_dir, |
325 | 325 | '%s.xml' % self._bundle_id) |
326 | | os.symlink(mime_path, installed_mime_path) |
| 326 | self._symlink(mime_path, installed_mime_path) |
327 | 327 | os.spawnlp(os.P_WAIT, 'update-mime-database', |
328 | 328 | 'update-mime-database', mime_dir) |
329 | 329 | |
… |
… |
class ActivityBundle(Bundle): |
339 | 339 | mime_type.replace('/', '-')) |
340 | 340 | svg_file = mime_icon_base + '.svg' |
341 | 341 | info_file = mime_icon_base + '.icon' |
342 | | if os.path.isfile(svg_file): |
343 | | os.symlink(svg_file, |
344 | | os.path.join(installed_icons_dir, |
345 | | os.path.basename(svg_file))) |
346 | | if os.path.isfile(info_file): |
347 | | os.symlink(info_file, |
348 | | os.path.join(installed_icons_dir, |
349 | | os.path.basename(info_file))) |
| 342 | self._symlink(svg_file, |
| 343 | os.path.join(installed_icons_dir, |
| 344 | os.path.basename(svg_file))) |
| 345 | self._symlink(info_file, |
| 346 | os.path.join(installed_icons_dir, |
| 347 | os.path.basename(info_file))) |
| 348 | |
350 | 349 | return install_path |
351 | 350 | |
| 351 | def _symlink(self, src, dst): |
| 352 | if not os.path.isfile(src): |
| 353 | return |
| 354 | if not os.path.islink(dst) and os.path.exists(dst): |
| 355 | raise RuntimeError('Do not remove %s if it was not ' |
| 356 | 'installed by sugar', dst) |
| 357 | logging.debug('Link resource %s to %s', src, dst) |
| 358 | if os.path.lexists(dst): |
| 359 | logging.debug('Relink %s', dst) |
| 360 | os.unlink(dst) |
| 361 | os.symlink(src, dst) |
| 362 | |
352 | 363 | def uninstall(self, install_path, force=False): |
353 | 364 | if os.path.islink(install_path): |
354 | 365 | # Don't remove the actual activity dir if it's a symbolic link |