mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 13:19:17 +00:00
add more default config paths for #108
This commit is contained in:
@@ -30,6 +30,8 @@ if ENV_PROFILE in os.environ:
|
|||||||
NAME = 'dotdrop'
|
NAME = 'dotdrop'
|
||||||
CONFIG = 'config.yaml'
|
CONFIG = 'config.yaml'
|
||||||
HOMECFG = '~/.config/{}'.format(NAME)
|
HOMECFG = '~/.config/{}'.format(NAME)
|
||||||
|
ETCXDGCFG = '/etc/xdg/{}'.format(NAME)
|
||||||
|
ETCCFG = '/etc/{}'.format(NAME)
|
||||||
|
|
||||||
BANNER = """ _ _ _
|
BANNER = """ _ _ _
|
||||||
__| | ___ | |_ __| |_ __ ___ _ __
|
__| | ___ | |_ __| |_ __ ___ _ __
|
||||||
@@ -142,12 +144,29 @@ class Options(AttrMonitor):
|
|||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
# look in home .config/dotdrop directory
|
# look in ~/.config/dotdrop
|
||||||
cfg = os.path.expanduser(HOMECFG)
|
cfg = os.path.expanduser(HOMECFG)
|
||||||
path = os.path.join(cfg, CONFIG)
|
path = os.path.join(cfg, CONFIG)
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
# look in /etc/xdg/dotdrop
|
||||||
|
path = os.path.join(ETCXDGCFG, CONFIG)
|
||||||
|
if os.path.exists(path):
|
||||||
|
return path
|
||||||
|
|
||||||
|
# look in /etc/dotdrop
|
||||||
|
path = os.path.join(ETCCFG, CONFIG)
|
||||||
|
if os.path.exists(path):
|
||||||
|
return path
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _find_cfg(self, paths):
|
||||||
|
"""try to find the config in the paths list"""
|
||||||
|
for path in paths:
|
||||||
|
if os.path.exists(path):
|
||||||
|
return path
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _header(self):
|
def _header(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user