File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1038,10 +1038,15 @@ def compile_source_files(
10381038 rel = src_path_obj .relative_to (components_dir_path )
10391039 obj_path = str (Path (obj_path ) / str (rel ))
10401040 except ValueError :
1041- if not os .path .isabs (source ["path" ]):
1042- obj_path = str (Path (obj_path ) / source ["path" ])
1043- else :
1044- obj_path = str (Path (obj_path ) / os .path .basename (src_path ))
1041+ # Preserve project substructure when possible
1042+ try :
1043+ rel_prj = src_path_obj .relative_to (Path (project_src_dir ).resolve ())
1044+ obj_path = str (Path (obj_path ) / str (rel_prj ))
1045+ except ValueError :
1046+ if not os .path .isabs (source ["path" ]):
1047+ obj_path = str (Path (obj_path ) / source ["path" ])
1048+ else :
1049+ obj_path = str (Path (obj_path ) / os .path .basename (src_path ))
10451050
10461051 preserve_source_file_extension = board .get (
10471052 "build.esp-idf.preserve_source_file_extension" , "yes"
You can’t perform that action at this time.
0 commit comments