diff --git a/diceware/config.py b/diceware/config.py index 1d994ed25d9ff74f2bbdcb375f6a82c8a5371342..1b7c87c94b5a3f8d1accb7368556bd550ce620ba 100644 --- a/diceware/config.py +++ b/diceware/config.py @@ -44,19 +44,19 @@ def valid_locations(): """The list of valid paths we look up for config files. We search for config files in the following locations (in that order): - 1a) dirs in colon-separated var $XDG_CONFIG_DIRS - 1b) /etc/xdg/diceware/diceware.ini # if $XDG_CONFIG_DIRS is undefined - 2a) $XDG_CONFIG_HOME/diceware/diceware.ini # if $XDG_CONFIG_HOME - # is defined - 2b) $HOME/.config/diceware/diceware.ini # if $HOME is defined - # but not $XDG_CONFIG_HOME - Finally we look also for - 3) ~/.diceware.ini + + 1a) dirs in colon-separated var $XDG_CONFIG_DIRS + 1b) /etc/xdg/diceware/diceware.ini # if $XDG_CONFIG_DIRS is undefined + 2a) $XDG_CONFIG_HOME/diceware/diceware.ini # if $XDG_CONFIG_HOME is defined + 2b) $HOME/.config/diceware/diceware.ini # if $HOME is defined but not $XDG_CONFIG_HOME + + Finally we look also for: + + 3) ~/.diceware.ini Later read configs override prior ones. Therefore an existing `~/.diceware.ini` contains values that cannot be overridden, except on commandline. - """ result = [] user_home = os.path.expanduser("~") diff --git a/diceware/wordlist.py b/diceware/wordlist.py index 787cfc4d614d0c51c1b5e896c9bc2677cd1ac121..65f4a98f657ffa928c491e2c6bcb50ff78a7751e 100644 --- a/diceware/wordlist.py +++ b/diceware/wordlist.py @@ -43,13 +43,13 @@ def get_wordlist_dirs(): """Get the directories in which wordlists can be stored. We look into the following dirs (in that order): - (1) Local `wordlists` dir (part of install) - (2a) ${XDG_DATA_HOME}/diceware/ (if $XDG_DATA_HOME is defined) - (2b) ${HOME}/.local/share/diceware/ (else) - (3a) `<DIR>/diceware/` for each <DIR> in ${XDG_DATA_DIRS} - (if ${XDG_DATA_DIRS} is defined) - (3b) /usr/local/share/diceware/, /usr/share/diceware/ - (else) + (1) Local `wordlists` dir (part of install) + (2a) ${XDG_DATA_HOME}/diceware/ (if $XDG_DATA_HOME is defined) + (2b) ${HOME}/.local/share/diceware/ (else) + if ${XDG_DATA_DIRS} is defined + (3a) `<DIR>/diceware/` for each <DIR> in ${XDG_DATA_DIRS} + else + (3b) /usr/local/share/diceware/, /usr/share/diceware/ """ xdg_data_dirs = os.getenv("XDG_DATA_DIRS") if not xdg_data_dirs: # unset or empty string