#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from Base import BaseRepository
from offlineimap import folder
+import offlineimap.folder.LocalStatus
import os, re
class LocalStatusRepository(BaseRepository):
return os.path.join(self.directory, foldername)
def makefolder(self, foldername):
- # "touch" the file.
- file = open(self.getfolderfilename(foldername), "ab")
+ # "touch" the file, truncating it.
+ 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