File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
crates/pcb-zen-core/src/lang Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -825,11 +825,29 @@ where
825825 validate_identifier_name ( & name, "Component name" ) ?;
826826
827827 let footprint_val: Value = param_parser. next ( ) ?;
828- let footprint = footprint_val
828+ let mut footprint = footprint_val
829829 . unpack_str ( )
830830 . ok_or ( ComponentError :: FootprintNotString ) ?
831831 . to_owned ( ) ;
832832
833+ // If the footprint is not a package:// URI, resolve relative to
834+ // the current file and convert to a stable package:// URI.
835+ if !footprint. starts_with ( pcb_sch:: PACKAGE_URI_PREFIX ) {
836+ if let Some ( ctx) = eval_ctx. eval_context ( ) {
837+ if let Some ( current_file) = ctx. get_source_path ( ) {
838+ let resolution = ctx. resolution ( ) ;
839+ if let Ok ( resolved) =
840+ ctx. get_config ( ) . resolve_path ( & footprint, current_file)
841+ {
842+ footprint = match resolution. format_package_uri ( & resolved) {
843+ Some ( uri) => uri,
844+ None => resolved. to_string_lossy ( ) . into_owned ( ) ,
845+ } ;
846+ }
847+ }
848+ }
849+ }
850+
833851 let pin_defs_val: Option < Value > = param_parser. next_opt ( ) ?;
834852
835853 let pins_val: Value = param_parser. next ( ) ?;
You can’t perform that action at this time.
0 commit comments