From 82229e126d892202b61b0a8943501f720ec56ad5 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 21 Sep 2022 08:00:58 -0300 Subject: [PATCH] [Copy_Files] Made 3D models use the project path as base - To avoid problems when KiCad is running from other place --- kibot/out_copy_files.py | 2 +- tests/test_plot/test_misc.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kibot/out_copy_files.py b/kibot/out_copy_files.py index 772916b4..3e782f2a 100644 --- a/kibot/out_copy_files.py +++ b/kibot/out_copy_files.py @@ -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): diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 38a5e1de..9ebc97de 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -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