Skip to content

Commit

Permalink
Fix clean path expansion to expand env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
dsifford authored and anishathalye committed Aug 7, 2018
1 parent f95cbe2 commit cf55ca5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dotbot/plugins/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def _clean(self, target, force):
Cleans all the broken symbolic links in target if they point to
a subdirectory of the base directory or if forced to clean.
'''
if not os.path.isdir(os.path.expanduser(target)):
if not os.path.isdir(os.path.expandvars(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)
for item in os.listdir(os.path.expandvars(os.path.expanduser(target))):
path = os.path.join(os.path.expandvars(os.path.expanduser(target)), item)
if not os.path.exists(path) and os.path.islink(path):
points_at = os.path.join(os.path.dirname(path), os.readlink(path))
if self._in_directory(path, self._context.base_directory()) or force:
Expand Down

0 comments on commit cf55ca5

Please sign in to comment.