mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-10 15:04:53 +00:00
fix(partition_table): Ignore UTF-8 BOM bytes in csv file
This commit is contained in:
@@ -62,6 +62,7 @@ class ParttoolTarget():
|
||||
self.baud = baud
|
||||
|
||||
gen.offset_part_table = partition_table_offset
|
||||
gen.quiet = True
|
||||
|
||||
def parse_esptool_args(esptool_args):
|
||||
results = list()
|
||||
@@ -82,17 +83,8 @@ class ParttoolTarget():
|
||||
self.esptool_erase_args = parse_esptool_args(esptool_erase_args)
|
||||
|
||||
if partition_table_file:
|
||||
partition_table = None
|
||||
with open(partition_table_file, 'rb') as f:
|
||||
input_is_binary = (f.read(2) == gen.PartitionDefinition.MAGIC_BYTES)
|
||||
f.seek(0)
|
||||
if input_is_binary:
|
||||
partition_table = gen.PartitionTable.from_binary(f.read())
|
||||
|
||||
if partition_table is None:
|
||||
with open(partition_table_file, 'r', encoding='utf-8') as f:
|
||||
f.seek(0)
|
||||
partition_table = gen.PartitionTable.from_csv(f.read())
|
||||
partition_table, _ = gen.PartitionTable.from_file(f)
|
||||
else:
|
||||
temp_file = tempfile.NamedTemporaryFile(delete=False)
|
||||
temp_file.close()
|
||||
|
Reference in New Issue
Block a user