[Copy_Files] Made 3D models use the project path as base

- To avoid problems when KiCad is running from other place
This commit is contained in:
Salvador E. Tropea 2022-09-21 08:00:58 -03:00
parent dff7d9d299
commit 82229e126d
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class FilesList(Optionable):
dest = os.path.basename(fname)
else:
dest = os.path.relpath(fname, os.getcwd())
return os.path.join(self.output_dir, dest)
return '${KIPRJMOD}/'+os.path.join(self.output_dir, dest)
class Copy_FilesOptions(Base3DOptions):

View File

@ -1464,7 +1464,8 @@ def test_copy_files_2(test_dir):
for m in MODELS:
ctx.expect_out_file(m, sub=True)
# Make sure the PCB points to them
ctx.search_in_file(prj+'.kicad_pcb', ['model "{}"'.format(m) for m in MODELS if m.endswith('wrl')], sub=True)
ctx.search_in_file(prj+'.kicad_pcb', ['model "{}"'.format(r'\$\{KIPRJMOD\}/'+m) for m in MODELS if m.endswith('wrl')],
sub=True)
# Some warnings
ctx.search_err(r'WARNING:\(W098\) 2 3D models downloaded') # 2 models are missing and they are downloaded
ctx.search_err(r'WARNING:\(W100\)', invert=True) # 2 models has the same name, but goes to different target