From cf55ca51881f4364774fde03fb5446f027cb0d74 Mon Sep 17 00:00:00 2001 From: Derek P Sifford Date: Mon, 6 Aug 2018 15:12:44 -0400 Subject: [PATCH] Fix clean path expansion to expand env vars --- dotbot/plugins/clean.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dotbot/plugins/clean.py b/dotbot/plugins/clean.py index 7e6cba1..22c975e 100644 --- a/dotbot/plugins/clean.py +++ b/dotbot/plugins/clean.py @@ -34,11 +34,11 @@ class Clean(dotbot.Plugin): 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: