mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 03:46:10 +00:00
ensure empty dst/src are allowed
This commit is contained in:
@@ -1075,6 +1075,15 @@ class CfgYaml:
|
|||||||
self._dbg('templating dotfiles paths')
|
self._dbg('templating dotfiles paths')
|
||||||
dotfiles = self.dotfiles.copy()
|
dotfiles = self.dotfiles.copy()
|
||||||
|
|
||||||
|
# make sure no dotfiles path is None
|
||||||
|
for dotfile in dotfiles.values():
|
||||||
|
src = dotfile[self.key_dotfile_src]
|
||||||
|
if src is None:
|
||||||
|
dotfile[self.key_dotfile_src] = ''
|
||||||
|
dst = dotfile[self.key_dotfile_dst]
|
||||||
|
if dst is None:
|
||||||
|
dotfile[self.key_dotfile_dst] = ''
|
||||||
|
|
||||||
# only keep dotfiles related to the selected profile
|
# only keep dotfiles related to the selected profile
|
||||||
pdfs = []
|
pdfs = []
|
||||||
pro = self.profiles.get(self._profile, [])
|
pro = self.profiles.get(self._profile, [])
|
||||||
@@ -1258,11 +1267,17 @@ class CfgYaml:
|
|||||||
"""recursively delete all none/empty values in a dictionary."""
|
"""recursively delete all none/empty values in a dictionary."""
|
||||||
new = {}
|
new = {}
|
||||||
for k, v in dic.items():
|
for k, v in dic.items():
|
||||||
if k == self.key_dotfiles and v:
|
if k == self.key_dotfile_src:
|
||||||
|
# allow empty dotfile src
|
||||||
|
new[k] = v
|
||||||
|
continue
|
||||||
|
if k == self.key_dotfile_dst:
|
||||||
|
# allow empty dotfile dst
|
||||||
new[k] = v
|
new[k] = v
|
||||||
continue
|
continue
|
||||||
newv = v
|
newv = v
|
||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
|
# recursive travers dict
|
||||||
newv = self._clear_none(v)
|
newv = self._clear_none(v)
|
||||||
if not newv:
|
if not newv:
|
||||||
# no empty dict
|
# no empty dict
|
||||||
|
|||||||
Reference in New Issue
Block a user