mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 02:36:11 +00:00
handle empty dotpath and empty dotfiles for profile
This commit is contained in:
@@ -68,6 +68,7 @@ class Cfg:
|
|||||||
key_profiles_incl = 'include'
|
key_profiles_incl = 'include'
|
||||||
|
|
||||||
# settings defaults
|
# settings defaults
|
||||||
|
default_dotpath = 'dotfiles'
|
||||||
default_backup = True
|
default_backup = True
|
||||||
default_create = True
|
default_create = True
|
||||||
default_banner = True
|
default_banner = True
|
||||||
@@ -229,6 +230,9 @@ class Cfg:
|
|||||||
self.content[self.key_profiles] = {}
|
self.content[self.key_profiles] = {}
|
||||||
self.lnk_profiles = self.content[self.key_profiles]
|
self.lnk_profiles = self.content[self.key_profiles]
|
||||||
for k, v in self.lnk_profiles.items():
|
for k, v in self.lnk_profiles.items():
|
||||||
|
if not v:
|
||||||
|
self.lnk_profiles[k] = {}
|
||||||
|
continue
|
||||||
if self.key_profiles_dots in v and \
|
if self.key_profiles_dots in v and \
|
||||||
v[self.key_profiles_dots] is None:
|
v[self.key_profiles_dots] is None:
|
||||||
# if has the dotfiles entry but is empty
|
# if has the dotfiles entry but is empty
|
||||||
@@ -328,6 +332,8 @@ class Cfg:
|
|||||||
# assign dotfiles to each profile
|
# assign dotfiles to each profile
|
||||||
for k, v in self.lnk_profiles.items():
|
for k, v in self.lnk_profiles.items():
|
||||||
self.prodots[k] = []
|
self.prodots[k] = []
|
||||||
|
if not v:
|
||||||
|
continue
|
||||||
if self.key_profiles_dots not in v:
|
if self.key_profiles_dots not in v:
|
||||||
# ensures is a list
|
# ensures is a list
|
||||||
v[self.key_profiles_dots] = []
|
v[self.key_profiles_dots] = []
|
||||||
@@ -490,6 +496,8 @@ class Cfg:
|
|||||||
|
|
||||||
def _complete_settings(self):
|
def _complete_settings(self):
|
||||||
"""set settings defaults if not present"""
|
"""set settings defaults if not present"""
|
||||||
|
if self.key_dotpath not in self.lnk_settings:
|
||||||
|
self.lnk_settings[self.key_dotpath] = self.default_dotpath
|
||||||
if self.key_backup not in self.lnk_settings:
|
if self.key_backup not in self.lnk_settings:
|
||||||
self.lnk_settings[self.key_backup] = self.default_backup
|
self.lnk_settings[self.key_backup] = self.default_backup
|
||||||
if self.key_create not in self.lnk_settings:
|
if self.key_create not in self.lnk_settings:
|
||||||
|
|||||||
Reference in New Issue
Block a user