summaryrefslogtreecommitdiff
path: root/lib/utils/paths.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-02-03 22:37:36 +0100
committerGitHub <noreply@github.com>2025-02-03 22:37:36 +0100
commit497fbcfab5734aac889f15b72384a6a8631fffa4 (patch)
tree1f1a690a6108d7e4e0fac599d4e554edae9db6f9 /lib/utils/paths.py
parente1c6d8c5956c7c3c5e158c1f7415edd5bc1a0cc1 (diff)
Add debug variable to enable sew stack elements (#3476)
Diffstat (limited to 'lib/utils/paths.py')
-rwxr-xr-xlib/utils/paths.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/utils/paths.py b/lib/utils/paths.py
index 2e9faa59..c9d7b046 100755
--- a/lib/utils/paths.py
+++ b/lib/utils/paths.py
@@ -3,12 +3,18 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-import sys
import os
+import sys
from os.path import dirname, realpath
+from pathlib import Path
import appdirs
+if sys.version_info >= (3, 11):
+ import tomllib # built-in in Python 3.11+
+else:
+ import tomli as tomllib
+
def get_bundled_dir(name=None):
if getattr(sys, 'frozen', None) is not None:
@@ -42,3 +48,13 @@ def get_user_dir(name=None):
path = os.path.join(path, name)
return path
+
+
+def get_ini():
+ debug_toml = Path(get_bundled_dir("DEBUG.toml"))
+ if debug_toml.exists():
+ with debug_toml.open("rb") as f:
+ ini = tomllib.load(f) # read DEBUG.toml file if exists, otherwise use default values in ini object
+ else:
+ ini = {}
+ return ini