From 83db26ada713ebfbf17c335d80aea8981c4f5ece Mon Sep 17 00:00:00 2001 From: dece Date: Thu, 11 Mar 2021 19:16:36 +0100 Subject: [PATCH] fs: add minimal module to get some directories --- bebop/fs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bebop/fs.py diff --git a/bebop/fs.py b/bebop/fs.py new file mode 100644 index 0000000..e0a347c --- /dev/null +++ b/bebop/fs.py @@ -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