From a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027 Mon Sep 17 00:00:00 2001 From: Joel Andres Granados Date: Fri, 30 May 2008 17:57:48 +0200 Subject: Check to see if the backup dir is present when creating it. If firstaidkit is run and does not end properly it is possible for the backup dir to already be there. The sane thing to do is to tell the user. --- pyfirstaidkit/utils/backup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfirstaidkit/utils/backup.py b/pyfirstaidkit/utils/backup.py index f68b154..d9bc1b9 100644 --- a/pyfirstaidkit/utils/backup.py +++ b/pyfirstaidkit/utils/backup.py @@ -179,7 +179,10 @@ class FileBackupStore(BackupStoreInterface): self._path = path self._backups = {} - os.makedirs(self._path) + if os.path.isdir(self._path): + raise BackupException("Backupdir %s already exists. Erase dir or change backup dir." % self._path) + else: + os.makedirs(self._path) self.__class__._singleton = weakref.proxy(self) print "Backup system initialized" -- cgit