diff --git a/Changelog.rst b/Changelog.rst index 0b485ee..082950f 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -8,6 +8,10 @@ ChangeLog OfflineIMAP v6.5.6.1 (YYYY-MM-DD) ================================= +* Create SQLite database directory if it doesn't exist + yet; warn if path is not a directory (Nick Farrell, + GutHub pull #102) + * Fix mangled message headers for servers without UIDPLUS: X-OfflineIMAP was added with preceeding '\n' instead of '\r\n' just before message was uploaded to the IMAP server. diff --git a/offlineimap/folder/LocalStatusSQLite.py b/offlineimap/folder/LocalStatusSQLite.py index f8921f1..e48545d 100644 --- a/offlineimap/folder/LocalStatusSQLite.py +++ b/offlineimap/folder/LocalStatusSQLite.py @@ -14,7 +14,7 @@ # 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -import os.path +import os import re from threading import Lock from .Base import BaseFolder @@ -51,6 +51,12 @@ class LocalStatusSQLiteFolder(BaseFolder): self._newfolder = False # flag if the folder is new + dirname = os.path.dirname(self.filename) + if not os.path.exists(dirname): + os.makedirs(dirname) + if not os.path.isdir(dirname): + raise UserWarning("SQLite database path '%s' is not a directory." % dirname) + # dblock protects against concurrent writes in same connection self._dblock = Lock()