~nataliabidart/ubuntuone-client/split-oauth

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/volume_manager.py

  • Committer: Tarmac
  • Author(s): guillermo.gonzalez at canonical
  • Date: 2010-05-23 14:54:28 UTC
  • mfrom: (519.1.3 fix-452682)
  • Revision ID: dobey@wayofthemonkey.com-20100523145428-qhuolduj8u6cfcue
Fix 'Shared With Me' symlink if the target was changed and the link is broken.

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
        if not os.path.exists(self.m.shares_dir_link):
310
310
            self.log.debug('creating Shares symlink: %r -> %r',
311
311
                           self.m.shares_dir_link, self.m.shares_dir)
 
312
            # remove the symlink if it's broken
 
313
            if os.path.islink(self.m.shares_dir_link) and \
 
314
               os.readlink(self.m.shares_dir_link) != self.m.shares_dir:
 
315
                os.remove(self.m.shares_dir_link)
312
316
            os.symlink(self.m.shares_dir, self.m.shares_dir_link)
313
317
        # make the shares_dir read only
314
318
        os.chmod(self.m.shares_dir, 0555)