Linting code

This commit is contained in:
jeffser
2024-08-04 21:20:47 -06:00
parent dd95e3df7e
commit 6ba3719031
6 changed files with 32 additions and 15 deletions

View File

@@ -1,18 +1,21 @@
# internal.py
"""
Handles paths, they can be different if the app is running as a Flatpak
"""
import os
app_id = "com.jeffser.Alpaca"
APP_ID = "com.jeffser.Alpaca"
in_flatpak = True if os.getenv("FLATPAK_ID") else False
IN_FLATPAK = bool(os.getenv("FLATPAK_ID"))
def get_xdg_home(env, default):
if in_flatpak:
if IN_FLATPAK:
return os.getenv(env)
else:
base = os.getenv(env) or os.path.expanduser(default)
path = os.path.join(base, app_id)
if not os.path.exists(path):
os.makedirs(path)
return path
base = os.getenv(env) or os.path.expanduser(default)
path = os.path.join(base, APP_ID)
if not os.path.exists(path):
os.makedirs(path)
return path
data_dir = get_xdg_home("XDG_DATA_HOME", "~/.local/share")