File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: BSD-3-Clause
44
55import getopt
6+ import os
67import sys
78
89from xml .etree import ElementTree as ET
@@ -46,14 +47,19 @@ def UpdateMetaData(TemplateRoot, PartitionRoot):
4647 PartitionsSet .add ((label , filename ))
4748 print (f"PartitionsSet: { PartitionsSet } " )
4849
49- def _add_file_elements (parent_element , file_name_text , file_path_flavor = None ):
50+ def _add_file_elements (parent_element , pathname , file_path_flavor = None ):
5051 """Helper function to add file_name and file_path sub-elements."""
52+ file_name_text = os .path .basename (pathname )
53+ file_path_text = os .path .dirname (pathname )
54+ if not file_path_text : # no directory, use explicit . as current dir
55+ file_path_text = "."
56+
5157 new_file_name = ET .SubElement (parent_element , "file_name" )
5258 new_file_name .text = file_name_text
5359 new_file_path = ET .SubElement (parent_element , "file_path" )
5460 if file_path_flavor :
5561 new_file_path .set ("flavor" , file_path_flavor )
56- new_file_path .text = "."
62+ new_file_path .text = file_path_text
5763
5864 builds = TemplateRoot .findall ('builds_flat/build' )
5965 for build in builds :
You can’t perform that action at this time.
0 commit comments