diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-05-30 17:57:48 +0200 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-05-30 17:57:48 +0200 |
commit | a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027 (patch) | |
tree | 6f1cdbb8d137114d409994e1ffc44974c2692aab /pyfirstaidkit | |
parent | 2479571f77597141a213cbb771cde3ba88d16eef (diff) | |
download | firstaidkit-a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027.tar.gz firstaidkit-a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027.tar.xz firstaidkit-a3a5eff6af00a7b5c2d968f4ea3ee4c94cc40027.zip |
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.
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r-- | pyfirstaidkit/utils/backup.py | 5 |
1 files changed, 4 insertions, 1 deletions
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" |