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):
# "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.close()
os.unlink(filename)
os.rename(filename + ".tmp", filename)
# Invalidate the cache.
self.folders = None