~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Martin Pool
  • Date: 2005-05-26 02:22:15 UTC
  • Revision ID: mbp@sourcefrog.net-20050526022214-3c33416ed1fbb212
- AtomicFile must cope without destination file existing on 
  win32
  (patch from John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        
52
52
        self.f.close()
53
53
        if sys.platform == 'win32':
54
 
            os.remove(self.realfilename)
 
54
            # windows cannot rename over an existing file
 
55
            try:
 
56
                os.remove(self.realfilename)
 
57
            except OSError, e:
 
58
                import errno
 
59
                if e.errno != errno.ENOENT:
 
60
                    raise
55
61
        os.rename(self.tmpfilename, self.realfilename)
56
62
 
57
63
    def abort(self):