From d6f4a8dab86754b05fa2bcb216dcb9716e111e52 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Mon, 3 Mar 2008 12:59:40 -0600 Subject: [PATCH] Make makefolder use same temporary name as folder/LocalStatus/save --- offlineimap/repository/LocalStatus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/offlineimap/repository/LocalStatus.py b/offlineimap/repository/LocalStatus.py index 5b0b4c2..048026d 100644 --- a/offlineimap/repository/LocalStatus.py +++ b/offlineimap/repository/LocalStatus.py @@ -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