1
0
mirror of https://github.com/OfflineIMAP/offlineimap.git synced 2024-06-27 07:35:07 +02:00

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