add download path setting

This commit is contained in:
2025-10-10 19:10:11 +02:00
parent b45a4895f5
commit d7d454a213
5 changed files with 34 additions and 18 deletions
+3 -1
View File
@@ -7,12 +7,13 @@ from core.utils.data.state import state
def create_config():
config = configparser.ConfigParser()
config["General"] = {"debug": True, "api_url": f"{state.api_url}", "aria2_threads": f"{state.aria2_threads}"}
config["General"] = {"debug": True, "api_url": f"{state.api_url}", "aria2_threads": f"{state.aria2_threads}", "download_path": f"{state.download_path}"}
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)
@@ -39,4 +40,5 @@ def read_config():
state.debug = config.getboolean("General", "debug")
state.api_url = config.get("General", "api_url")
state.aria2_threads = config.getint("General", "aria2_threads")
state.download_path = config.get("General", "download_path")
+2 -3
View File
@@ -1,7 +1,6 @@
from core.utils.data.state import state
from .config import create_config
import os
import platform
def restart_aria2c():
import main # had to do this because of circle import :(
@@ -14,10 +13,10 @@ def restart_aria2c():
atexit.unregister(main.kill_aria2server)
atexit.register(main.kill_aria2server)
def save_settings(thread_count, close, apiurl):
def save_settings(thread_count, close, apiurl, download_path):
state.aria2_threads = thread_count
state.api_url = apiurl
state.download_path = download_path
create_config()
restart_aria2c()