mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
fixed settings write bug and add a comment-style title
This commit is contained in:
@@ -14,6 +14,10 @@ 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):
|
||||||
|
|
||||||
|
state.aria2_threads = thread_count
|
||||||
|
state.api_url = apiurl
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
|
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
|
||||||
else:
|
else:
|
||||||
@@ -22,11 +26,11 @@ def save_settings(thread_count, close, apiurl):
|
|||||||
os.makedirs(settings_path, exist_ok=True)
|
os.makedirs(settings_path, exist_ok=True)
|
||||||
|
|
||||||
with open(os.path.join(settings_path, "config.yml"), 'w') as f:
|
with open(os.path.join(settings_path, "config.yml"), 'w') as f:
|
||||||
|
f.write("# SoftwareManager Config file\n\n")
|
||||||
f.write(f"aria2_threads: {state.aria2_threads}\n")
|
f.write(f"aria2_threads: {state.aria2_threads}\n")
|
||||||
f.write(f"api_url: {state.api_url}\n")
|
f.write(f"api_url: {state.api_url}\n")
|
||||||
|
|
||||||
state.aria2_threads = thread_count
|
|
||||||
state.api_url = apiurl
|
|
||||||
restart_aria2c()
|
restart_aria2c()
|
||||||
|
|
||||||
close()
|
close()
|
||||||
|
|||||||
Reference in New Issue
Block a user