create config file. doesnt load yet

This commit is contained in:
2025-10-10 02:41:49 +02:00
parent 62b8506d13
commit b0596e9710
2 changed files with 16 additions and 3 deletions
+15 -2
View File
@@ -1,5 +1,6 @@
from core.utils.data.state import state from core.utils.data.state import state
import os
import platform
def restart_aria2c(): def restart_aria2c():
import main # had to do this because of circle import :( import main # had to do this because of circle import :(
@@ -13,7 +14,19 @@ def restart_aria2c():
atexit.register(main.kill_aria2server) atexit.register(main.kill_aria2server)
def save_settings(thread_count, close, apiurl): def save_settings(thread_count, close, apiurl):
if platform.system() == "Windows":
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
else:
config_dir = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
settings_path = os.path.join(config_dir, "SoftwareManager")
os.makedirs(settings_path, exist_ok=True)
with open(os.path.join(settings_path, "config.yml"), 'w') as f:
f.write(f"aria2_threads: {state.aria2_threads}\n")
f.write(f"api_url: {state.api_url}\n")
state.aria2_threads = thread_count state.aria2_threads = thread_count
state.api_url = apiurl state.api_url = apiurl
restart_aria2c() restart_aria2c()
close()
close()
+1 -1
View File
@@ -5,4 +5,4 @@ darkdetect==0.8.0
aria2p==0.12.1 aria2p==0.12.1
pyinstaller==6.15.0 pyinstaller==6.15.0
pyqtdarktheme==0.1.7 pyqtdarktheme==0.1.7
aiohttp==3.13.0 aiohttp==3.13.0