Severity: Medium (silently breaks config persistence when launched from a different directory)
Description
backend/config.py defines the config file path as a relative path:
CONFIG_FILE = "config/config.json"
config = Config()
qconfig.load(CONFIG_FILE, config)
This resolves against the current working directory (CWD), not the script's location. If the user launches the app from anywhere other than the project root, qconfig.load() silently fails to find the file, and qconfig.save() (called when settings change) writes to a wrong location.
Consequences:
- Settings are never persisted (user changes language → restarts → back to default)
- Window position is never saved/restored
- The bug in Issue 1 is indirectly masked because every launch looks like a fresh install
Fix
Use an absolute path resolved from the script's location:
CONFIG_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "config", "config.json"
)
config = Config()
qconfig.load(CONFIG_FILE, config)
__file__ resolves to the path of backend/config.py, so .. navigates up to the project root, then into config/config.json. This works regardless of CWD.
(Note: if this is later bundled with PyInstaller, __file__ behavior changes — that would need separate handling with sys._MEIPASS. But for source-code usage, this fix is correct and safe.)
Location
backend/config.py line ~100 (the CONFIG_FILE assignment)
Severity: Medium (silently breaks config persistence when launched from a different directory)
Description
backend/config.pydefines the config file path as a relative path:This resolves against the current working directory (CWD), not the script's location. If the user launches the app from anywhere other than the project root,
qconfig.load()silently fails to find the file, andqconfig.save()(called when settings change) writes to a wrong location.Consequences:
Fix
Use an absolute path resolved from the script's location:
__file__resolves to the path ofbackend/config.py, so..navigates up to the project root, then intoconfig/config.json. This works regardless of CWD.(Note: if this is later bundled with PyInstaller,
__file__behavior changes — that would need separate handling withsys._MEIPASS. But for source-code usage, this fix is correct and safe.)Location
backend/config.pyline ~100 (theCONFIG_FILEassignment)