mirror of
https://github.com/cheat/cheat.git
synced 2024-12-18 18:55:06 +01:00
Added support for ~
and environment variables in DEFAULT_CHEAT_DIR
If the `DEFAULT_CHEAT_DIR` environment variable contains the `~` — as shortcut for the users home directory — or environment variables like `$HOME`, the program bails. This change allows the usage of both.
This commit is contained in:
parent
403d715127
commit
05400a92ed
@ -7,7 +7,8 @@ def default_path():
|
|||||||
""" Returns the default cheatsheet path """
|
""" Returns the default cheatsheet path """
|
||||||
|
|
||||||
# determine the default cheatsheet dir
|
# determine the default cheatsheet dir
|
||||||
default_sheets_dir = os.environ.get('DEFAULT_CHEAT_DIR') or os.path.join(os.path.expanduser('~'), '.cheat')
|
default_sheets_dir = os.environ.get('DEFAULT_CHEAT_DIR') or os.path.join('~', '.cheat')
|
||||||
|
default_sheets_dir = os.path.expanduser(os.path.expandvars(default_sheets_dir))
|
||||||
|
|
||||||
# create the DEFAULT_CHEAT_DIR if it does not exist
|
# create the DEFAULT_CHEAT_DIR if it does not exist
|
||||||
if not os.path.isdir(default_sheets_dir):
|
if not os.path.isdir(default_sheets_dir):
|
||||||
|
Loading…
Reference in New Issue
Block a user