Skip to content

Commit 42752b8

Browse files
committed
fixes
1 parent 13814ed commit 42752b8

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

smct/config.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import requests
55

6-
from smct import paths, registry, ui
6+
from smct import paths, ui
77
from smct.logger import log
88

99
# config.ini structure
@@ -21,6 +21,10 @@
2121

2222

2323
def _check_for_missing_files():
24+
if not os.path.exists(paths.CONFIG_PATH):
25+
log("creating default config")
26+
_create_default_config_file()
27+
2428
if not os.path.exists(paths.ASSETS_DIR_PATH):
2529
os.mkdir(paths.ASSETS_DIR_PATH)
2630
log(f"Creating {paths.ASSETS_DIR_PATH}")
@@ -60,17 +64,8 @@ def download_assets_file(image_name):
6064

6165

6266
def init_config():
63-
if not os.path.exists(paths.CONFIG_PATH):
64-
log("config.ini not found, creating default config")
65-
_create_default_config_file()
66-
6767
_check_for_missing_files()
6868

69-
if get_start_with_windows_value():
70-
registry.add_to_autostart()
71-
else:
72-
registry.remove_from_autostart()
73-
7469
if get_first_start_value():
7570
ui.init_root_window()
7671
set_first_start_value(False)

smct/logger.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import logging
22
import os
3-
from smct import paths
3+
from smct.paths import LOG_PATH
44

5-
LOGFILENAME = paths.LOG_PATH
65
ENCODING = "utf-8"
76

87
LOG = None
@@ -16,18 +15,18 @@ def log(text):
1615

1716

1817
def clear_log_if_needed():
19-
if os.path.exists(LOGFILENAME):
20-
with open(LOGFILENAME, "r", encoding=ENCODING) as file:
18+
if os.path.exists(LOG_PATH):
19+
with open(LOG_PATH, "r", encoding=ENCODING) as file:
2120
lines = file.readlines()
2221
if len(lines) > LOG_LINE_LIMIT:
23-
with open(LOGFILENAME, "w", encoding=ENCODING) as file:
22+
with open(LOG_PATH, "w", encoding=ENCODING) as file:
2423
file.write("")
2524

2625

2726
if STARTUP:
2827
clear_log_if_needed()
2928
logging.basicConfig(
30-
filename=LOGFILENAME,
29+
filename=LOG_PATH,
3130
level=logging.INFO,
3231
format="%(asctime)s - %(levelname)s - %(message)s",
3332
)

0 commit comments

Comments
 (0)