Skip to content

Commit 554cbb5

Browse files
committed
Add bom output directory to search list for netlist/xml
Issue #102
1 parent 6a5523e commit 554cbb5

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

InteractiveHtmlBom/core/ibom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ def save_config(dialog_panel):
302302
)
303303
try:
304304
config.netlist_initial_directory = os.path.dirname(parser.file_name)
305-
extra_data_file = parser.latest_extra_data()
305+
extra_data_file = parser.latest_extra_data(
306+
extra_dirs=[config.bom_dest_dir])
306307
if extra_data_file is not None:
307308
dlg.set_extra_data_path(extra_data_file)
308309
config.transfer_to_dialog(dlg.panel)

InteractiveHtmlBom/ecad/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ def parse(self):
2424
"""
2525
pass
2626

27-
def latest_extra_data(self):
27+
def latest_extra_data(self, extra_dirs=None):
2828
"""
2929
Abstract method that may be overridden in implementations that support
3030
extra field data.
31+
:param extra_dirs: List of extra directories to search.
3132
:return: File name of most recent file with extra field data.
3233
"""
3334
return None

InteractiveHtmlBom/ecad/kicad.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ def __init__(self, file_name, logger, board=None):
2020
self.font_parser = FontParser()
2121
self.extra_data_func = parse_schematic_data
2222

23-
def latest_extra_data(self):
23+
def latest_extra_data(self, extra_dirs=None):
2424
base_name = os.path.splitext(os.path.basename(self.file_name))[0]
25-
output_dir = self.board.GetPlotOptions().GetOutputDirectory()
25+
extra_dirs.append(self.board.GetPlotOptions().GetOutputDirectory())
2626
file_dir_name = os.path.dirname(self.file_name)
27-
if not os.path.isabs(output_dir):
28-
output_dir = os.path.join(file_dir_name, output_dir)
2927
directories = [
3028
file_dir_name,
31-
output_dir
3229
]
30+
for dir in extra_dirs:
31+
if not os.path.isabs(dir):
32+
dir = os.path.join(file_dir_name, dir)
33+
if os.path.exists(dir):
34+
directories.append(dir)
3335
return find_latest_schematic_data(base_name, directories)
3436

3537
@staticmethod

0 commit comments

Comments
 (0)