diff options
author | Anish Athalye <me@anishathalye.com> | 2015-01-26 10:38:08 -0500 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2015-01-26 10:38:08 -0500 |
commit | 0b4b79e422908e49e2f1f7128f79b659348092b1 (patch) | |
tree | 50749977ede223bfc1160ac7ba031f0a2d540f72 /dotbot | |
parent | 69502854aaa7597bca9b341b3ce05efa10b4b9d1 (diff) |
Allow nonexistent directories to be cleaned
Make nonexistent directories be skipped when cleaning.
Diffstat (limited to 'dotbot')
-rw-r--r-- | dotbot/executor/cleaner.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/dotbot/executor/cleaner.py b/dotbot/executor/cleaner.py index 79b485f..504c0de 100644 --- a/dotbot/executor/cleaner.py +++ b/dotbot/executor/cleaner.py @@ -31,6 +31,9 @@ class Cleaner(Executor): Cleans all the broken symbolic links in target that point to a subdirectory of the base directory. ''' + if not os.path.isdir(os.path.expanduser(target)): + self._log.debug('Ignoring nonexistent directory %s' % target) + return True for item in os.listdir(os.path.expanduser(target)): path = os.path.join(os.path.expanduser(target), item) if not os.path.exists(path) and os.path.islink(path): |