diff options
| author | suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> | 2023-04-25 05:12:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-24 20:12:42 -0700 |
| commit | d6f336d84b8b00161a688d4b39b82165a3ebe1f3 (patch) | |
| tree | 6b166fa18cdde58e73ab0d4a2a1d275842e5c039 /backend/localplatform.py | |
| parent | 4777963b65ea9310bcdd3f56a6516cf15476e490 (diff) | |
| download | decky-loader-d6f336d84b8b00161a688d4b39b82165a3ebe1f3.tar.gz decky-loader-d6f336d84b8b00161a688d4b39b82165a3ebe1f3.zip | |
Feat/configurable paths (#404)v2.7.2-pre2
Diffstat (limited to 'backend/localplatform.py')
| -rw-r--r-- | backend/localplatform.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/backend/localplatform.py b/backend/localplatform.py index c1453227..a788d59f 100644 --- a/backend/localplatform.py +++ b/backend/localplatform.py @@ -1,4 +1,4 @@ -import platform +import platform, os ON_WINDOWS = platform.system() == "Windows" ON_LINUX = not ON_WINDOWS @@ -8,4 +8,33 @@ if ON_WINDOWS: import localplatformwin as localplatform else: from localplatformlinux import * - import localplatformlinux as localplatform
\ No newline at end of file + import localplatformlinux as localplatform + +def get_privileged_path() -> str: + '''Get path accessible by elevated user. Holds plugins, decky loader and decky loader configs''' + return localplatform.get_privileged_path() + +def get_unprivileged_path() -> str: + '''Get path accessible by non-elevated user. Holds plugin configuration, plugin data and plugin logs. Externally referred to as the 'Homebrew' directory''' + return localplatform.get_unprivileged_path() + +def get_unprivileged_user() -> str: + '''Get user that should own files made in unprivileged path''' + return localplatform.get_unprivileged_user() + +def get_chown_plugin_path() -> bool: + return os.getenv("CHOWN_PLUGIN_PATH", "1") == "1" + +def get_server_host() -> str: + return os.getenv("SERVER_HOST", "127.0.0.1") + +def get_server_port() -> int: + return int(os.getenv("SERVER_PORT", "1337")) + +def get_live_reload() -> bool: + os.getenv("LIVE_RELOAD", "1") == "1" + +def get_log_level() -> int: + return {"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10}[ + os.getenv("LOG_LEVEL", "INFO") + ]
\ No newline at end of file |
