diff --git a/dotdrop/updater.py b/dotdrop/updater.py index b19fa3f..78c8634 100644 --- a/dotdrop/updater.py +++ b/dotdrop/updater.py @@ -93,13 +93,12 @@ class Updater: new_path = self._apply_trans_w(path, dotfile) if not new_path: return False - path = new_path - if os.path.isdir(path): - ret = self._handle_dir(path, dtpath) + if os.path.isdir(new_path): + ret = self._handle_dir(new_path, dtpath) else: - ret = self._handle_file(path, dtpath) + ret = self._handle_file(new_path, dtpath) # clean temporary files - if new_path and os.path.exists(new_path): + if new_path != path and os.path.exists(new_path): remove(new_path) return ret diff --git a/tests-ng/transformations.sh b/tests-ng/transformations.sh index 2f1861c..1b62b9b 100755 --- a/tests-ng/transformations.sh +++ b/tests-ng/transformations.sh @@ -164,6 +164,13 @@ set -e # test update ########################### +# update single file +echo 'update' > ${tmpd}/def +cd ${ddpath} | ${bin} update -f -k -c ${cfg} -p p1 -b -V f_def +[ "$?" != "0" ] && exit 1 +[ ! -e ${tmpd}/def ] && echo 'dotfile in FS removed' && exit 1 +[ ! -e ${tmps}/dotfiles/def ] && echo 'dotfile in dotpath removed' && exit 1 + # update single file cd ${ddpath} | ${bin} update -f -k -c ${cfg} -p p1 -b -V f_abc [ "$?" != "0" ] && exit 1