1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 20:54:51 +00:00

Fail if source isn't a directory

This commit is contained in:
Marcel Robitaille
2019-01-20 13:34:26 -04:00
parent 1ad2d7c961
commit e119b8829e

View File

@@ -84,10 +84,18 @@ class Installer:
"""link all dotfiles in a given directory"""
self.action_executed = False
parent = os.path.join(self.base, os.path.expanduser(src))
# Fail if source doesn't exist
if not os.path.exists(parent):
self.log.err('source dotfile does not exist: {}'.format(parent))
return []
# Fail if source not a directory
if not os.path.isdir(parent):
self.log.err('source dotfile is not a directory: {}'
.format(parent))
return []
dst = os.path.normpath(os.path.expanduser(dst))
if not os.path.lexists(dst):
self.log.sub('creating directory "{}"'.format(dst))