I have my KiCad libraries stored in iCloud Drive and I use the following script to create a list of symbols to append to the end of the KiCad ‘sym_lib_table’ file (in the preferences folder). This works fine and I do the same for other programs, which macOS handles internally without issues.
When I use an absolute path, everything seems to work correctly and the symbols (and footprints) are found properly. I also created a KiCad path variable called ‘KICAD_USER_LIBS’ pointing to my KiCad library folder, which my script translates to entries like:
(lib (name "SparkFun-Battery")(type "KiCad")(uri "${KICAD_USER_LIBS}/symbols/SparkFun/SparkFun-Battery.kicad_sym")(options "")(descr ""))
This format appears similar to the standard entries like:
${KICAD9_SYMBOL_DIR}/Transistor_FET.kicad_sym
and shows fine in the symbol manager.
However, although the ‘KICAD9_SYMBOL_DIR’ variable resolves correctly, the ‘KICAD_USER_LIBS’ variable resolves to:
~/iCloud Drive/KiCad/KiCad_libraries/symbols/SparkFun/SparkFun-Battery.kicad_sym
This results in the error message:
“Library file ‘~/iCloud Drive/KiCad/KiCad_libraries/symbols/SparkFun/SparkFun-Battery.kicad_sym’ not found. Error loading symbol library SparkFun-Board.”
For now, I’ve reverted to using the full absolute path, but my question is: Why can’t KiCad resolve the tilde (~) to an absolute path like it should, making the path for KiCad:
/Volumes/Puddle/Users/MeMe/Library/Mobile Documents/com~apple~CloudDocs/KiCad/KiCad_libraries/
?
The script that I created. BTW, the same thing counts for my footprint script, the script works fine but the path resolving gets wrong.
symbol_library_path_builder-v2.py (1.9 KB)