From 270ee027f729685a0698e75f29236b64c50c8b95 Mon Sep 17 00:00:00 2001 From: Vxrtrauter <101264710+Vxrtrauter@users.noreply.github.com> Date: Mon, 16 Mar 2026 02:31:03 +0100 Subject: [PATCH] feat: add semi-dynamic discovering of build info file --- src/core/interface/dialogs/update.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/interface/dialogs/update.py b/src/core/interface/dialogs/update.py index 3896b29..f2184e0 100644 --- a/src/core/interface/dialogs/update.py +++ b/src/core/interface/dialogs/update.py @@ -8,9 +8,22 @@ import platform import json import os -def get_version(): +def _get_build_info_path() -> (Path | None): + current_dir = Path(__file__).resolve().parent + + for _ in range(6): # Climb max 6 directories + file = current_dir / "build_info.json" + if file.exists(): + return file + # Go up one directory if file isn't found + current_dir = current_dir.parent + + return None + + +def get_version() -> None: # Get build info filepath - build_info_path = Path(__file__).resolve().parents[4] / "build_info.json" # parents[4] = climb up 5 directories from the file ran + build_info_path = _get_build_info_path() if os.path.exists(build_info_path): with open(build_info_path, "r") as f: build_info = json.load(f)