mirror of
https://github.com/szymon-jozef/zutui.git
synced 2026-09-07 20:20:42 +02:00
Added xdg-compliant path for Linux and macOS
This commit is contained in:
19
zut_app/config.py
Normal file
19
zut_app/config.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
USER_HOME = os.path.expanduser("~")
|
||||
WINDOWS_PATH = "zutui" # probably should be in %AppData% or something, but I'm not sure, so I won't change it
|
||||
LINUX_PATH = ".config/zutui"
|
||||
|
||||
def get_config_path():
|
||||
system = platform.system()
|
||||
if system == "Windows":
|
||||
APP_DIR = os.path.join(USER_HOME, WINDOWS_PATH)
|
||||
elif system in ["Linux", "Darwin"]:
|
||||
APP_DIR = os.path.join(USER_HOME, LINUX_PATH)
|
||||
else:
|
||||
print(f"System {system} not supported, aborting...")
|
||||
exit(1)
|
||||
if not os.path.exists(APP_DIR):
|
||||
os.makedirs(APP_DIR)
|
||||
return APP_DIR
|
||||
Reference in New Issue
Block a user