Skip to content

Commit 08bc8e6

Browse files
committed
Fix loading of last config file setting
The startup config loading path now uses the already-resolved `last_cfg_file` object instead of re-reading a string path and re-checking it. This aligns the load logic with the earlier file resolution step and updates related log messages from “path” to “file”.
1 parent 0776ef1 commit 08bc8e6

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

‎dlclivegui/gui/main_window.py‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,14 @@ def __init__(self, config: ApplicationSettings | None = None):
116116

117117
else:
118118
# 2) last config file path
119-
last_cfg_path = self._settings_store.get_last_config_path()
120-
if last_cfg_path:
119+
if last_cfg_file is not None:
121120
try:
122-
p = Path(last_cfg_path)
123-
if p.exists() and p.is_file():
124-
config = ApplicationSettings.load(str(p))
125-
self._config_path = p
126-
logger.info(f"Loaded configuration from last config path: {p}")
127-
else:
128-
config = DEFAULT_CONFIG
129-
self._config_path = None
121+
config = ApplicationSettings.load(str(last_cfg_file))
122+
self._config_path = last_cfg_file
123+
logger.info(f"Loaded configuration from last config file: {last_cfg_file}")
130124
except Exception as exc:
131125
logger.warning(
132-
f"Failed to load last config path ({last_cfg_path}): {exc}. Using default config."
126+
f"Failed to load last config file ({last_cfg_file}): {exc}. Using default config."
133127
)
134128
config = DEFAULT_CONFIG
135129
self._config_path = None

0 commit comments

Comments
 (0)