Create SQLite DB directory if it doesn't exist yet
Also check if DB path doesn't point to a directory. By: Nick Farrell GitHub: https://github.com/OfflineIMAP/offlineimap/pull/102 Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
		@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user