From 4559d98b0781ee94cb64b22838b870cdb404b6eb Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 5 Nov 2014 13:11:14 +0800 Subject: [PATCH] Backup command fails when the backup directory is missing --- mdk/backup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mdk/backup.py b/mdk/backup.py index 856e9f1..3b34a23 100644 --- a/mdk/backup.py +++ b/mdk/backup.py @@ -28,7 +28,7 @@ import time import logging from distutils.dir_util import copy_tree -from .tools import chmodRecursive +from .tools import chmodRecursive, mkdir from .db import DB from .config import Conf from .workplace import Workplace @@ -43,6 +43,8 @@ class BackupManager(object): def __init__(self): self.path = os.path.expanduser(os.path.join(C.get('dirs.moodle'), 'backup')) + if not os.path.exists(self.path): + mkdir(self.path, 0777) def create(self, M): """Creates a new backup of M""" -- 2.11.0