Linting code
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user