Make makefolder use same temporary name as folder/LocalStatus/save

This commit is contained in:
John Goerzen 2008-03-03 12:59:40 -06:00
parent aaf9478535
commit d6f4a8dab8

View File

@ -39,9 +39,13 @@ class LocalStatusRepository(BaseRepository):
def makefolder(self, foldername): def makefolder(self, foldername):
# "touch" the file, truncating it. # "touch" the file, truncating it.
file = open(self.getfolderfilename(foldername), "wb") filename = self.getfolderfilename(foldername)
file = open(filename + ".tmp", "wb")
file.write(offlineimap.folder.LocalStatus.magicline + '\n') file.write(offlineimap.folder.LocalStatus.magicline + '\n')
file.close() file.close()
os.unlink(filename)
os.rename(filename + ".tmp", filename)
# Invalidate the cache. # Invalidate the cache.
self.folders = None self.folders = None