diff --git a/dotdrop/cfg_yaml.py b/dotdrop/cfg_yaml.py index acfd5c3..faaf797 100644 --- a/dotdrop/cfg_yaml.py +++ b/dotdrop/cfg_yaml.py @@ -324,11 +324,16 @@ class CfgYaml: def add_dotfile_to_profile(self, dotfile_key, profile_key): """add an existing dotfile key to a profile_key""" + # create the profile if it doesn't exist self._new_profile(profile_key) - profile = self._yaml_dict[self.key_profiles][profile_key] + profile = self.profiles[profile_key] + + # ensure profile dotfiles list is not None if self.key_profile_dotfiles not in profile or \ profile[self.key_profile_dotfiles] is None: profile[self.key_profile_dotfiles] = [] + + # add to the profile pdfs = profile[self.key_profile_dotfiles] if self.key_all not in pdfs and \ dotfile_key not in pdfs: diff --git a/dotdrop/importer.py b/dotdrop/importer.py index 0db389a..4115d3e 100644 --- a/dotdrop/importer.py +++ b/dotdrop/importer.py @@ -115,7 +115,7 @@ class Importer: self.log.err('importing \"{}\" failed!'.format(path)) return -1 - if self._already_exists(path, dst): + if self._already_exists(src, dst): return -1 self.log.dbg('import dotfile: src:{} dst:{}'.format(src, dst)) diff --git a/tests-ng/profile-import-dotfiles.sh b/tests-ng/profile-import-dotfiles.sh index 8505cdc..d0fa00b 100755 --- a/tests-ng/profile-import-dotfiles.sh +++ b/tests-ng/profile-import-dotfiles.sh @@ -107,7 +107,7 @@ echo '----------' cat ${cfg2} cnt=$(cd ${ddpath} | ${bin} files -G -c ${cfg} -p p1 | grep '^f_def' | wc -l) -[ "${cnt}" != "1" ] && echo "imported twice!" && exit 1 +[ "${cnt}" != "1" ] && echo "imported twice! (${cnt})" && exit 1 echo "OK" exit 0