app
KiCad - the KiCad Bridge
Public Made by Adomby adom
Reference implementation of the KiCad bridge: multi-instance Python server, forward path via kicad-cli, reverse path via in-process plugin. Most complex of the three bundled bridges.
← Commit history
0.9.274: Wiki #71 root cause: on a OneDrive-redirected Documents the bridge used %USERPROFILE%/Documents while KiCad resolves the shell Documents folder, so the bridge wrote and reported symbols in a file KiCad never reads. Fix: kicad_detect resolves user_dir like KiCad (handlers/win_paths), the Adom symbol and footprint libraries are ROW-FIRST (install writes to the file sym-/fp-lib-table registers), adom_library_status reports registeredPath/bridgeDefaultPath/split/orphanedLibrary, and the library_cache_stale verdict is built from that measurement instead of a cache story (both prior explanations were disproved by Ray).
2 files changed
+37−7
kicad_detect.py+22−6@@ -180,12 +180,28 @@ def _win_find_config_dir(version: str): def _win_find_user_dir(version: str):- """Find KiCad user dir on Windows: %USERPROFILE%/Documents/KiCad/<version>/"""- userprofile = os.environ.get("USERPROFILE", "")- if not userprofile:- return None- user = Path(userprofile) / "Documents" / "KiCad" / version- return user if user.exists() else None+ """KiCad's per-user dir: <Documents>/KiCad/<version>/ where <Documents> is the+ SHELL known folder, exactly as KiCad resolves it (wxStandardPaths ->+ FOLDERID_Documents). With OneDrive Known Folder Redirection that is+ %USERPROFILE%/OneDrive/Documents; the naive %USERPROFILE%/Documents this used+ to return made the bridge create a second, empty Adom library that KiCad never+ read (wiki #71). Shell first; the naive tree is only a fallback for a box+ where the shell folder has no KiCad dir at all."""+ try:+ from handlers.win_paths import documents_candidates+ cands = documents_candidates()+ except Exception:+ cands = []+ if not cands:+ userprofile = os.environ.get("USERPROFILE", "")+ if not userprofile:+ return None+ cands = [Path(userprofile) / "Documents"]+ for docs in cands:+ user = docs / "KiCad" / version+ if user.exists():+ return user+ return None def ensure_win_user_config(version: str, base_dir):
server.py+15−1@@ -191,8 +191,22 @@ kicad_info = None # default kicad_info (newest installed) all_kicad_versions: list = [] # every installed version, newest first def _handle_adom_library_status(kicad_info: dict, args: dict) -> dict:- """Return the status of the Adom symbol library."""+ """Return the status of the Adom symbol library.++ wiki #71: also say WHICH Adom.kicad_sym KiCad reads (the sym-lib-table row)+ and whether that is the file the bridge writes. A confident registered:true /+ exists:true hid a box where those were two different files.""" result = ensure_adom_library(kicad_info)+ try:+ from adom_library import library_split_report+ result.update(library_split_report(kicad_info))+ if result.get("split"):+ result["_hint"] = ("SPLIT: the registered Adom library and the bridge's default path "+ "are different files. KiCad reads registeredPath; symbols in "+ "bridgeDefaultPath are invisible to it. Installs write to "+ "registeredPath from 0.9.274.")+ except Exception:+ pass return {"success": True, **result}