mitype
mitype copied to clipboard
Follow the XDG Base Directory Specification
There is XDG Base Directory Specification which dictates which files should go where.
According to that user data should go to $XDG_DATA_HOME on linux.
https://github.com/Mithil467/mitype/blob/cdb2da1f40611f6e44ccba50eccd135b3a503bc3/mitype/history.py#L17
Without adding extra pip dependency:
from sys import platform
if platform == "linux" or platform == "linux2":
XDG_DATA_HOME = os.environ.get('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
user_data_file = XDG_DATA_HOME + "/.mitype_history.csv"
return os.path.expanduser(user_data_file)
else:
# as usual for windows