fs: add minimal module to get some directories

This commit is contained in:
dece 2021-03-11 19:16:36 +01:00
parent 1b8127eea1
commit 83db26ada7

18
bebop/fs.py Normal file
View file

@ -0,0 +1,18 @@
"""Retrieve some paths from filesystem.
A lot of logic comes from `appdirs`:
https://github.com/ActiveState/appdirs/blob/master/appdirs.py
"""
from os import getenv
from os.path import expanduser, join
APP_NAME = "bebop"
def get_user_data_dir():
"""Return the user data directory."""
path = getenv("XDG_DATA_HOME", expanduser("~/.local/share"))
path = join(path, APP_NAME)
return path