mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
[CLI] Force dump_lines()
to always use Unix line endings (#23954)
This commit is contained in:
parent
53a0cdc446
commit
0a5b892820
|
@ -102,7 +102,9 @@ def dump_lines(output_file, lines, quiet=True):
|
||||||
output_file.parent.mkdir(parents=True, exist_ok=True)
|
output_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
if output_file.exists():
|
if output_file.exists():
|
||||||
output_file.replace(output_file.parent / (output_file.name + '.bak'))
|
output_file.replace(output_file.parent / (output_file.name + '.bak'))
|
||||||
output_file.write_text(generated, encoding='utf-8')
|
with open(output_file, 'w', encoding='utf-8', newline='\n') as f:
|
||||||
|
f.write(generated)
|
||||||
|
# output_file.write_text(generated, encoding='utf-8', newline='\n') # `newline` needs Python 3.10
|
||||||
|
|
||||||
if not quiet:
|
if not quiet:
|
||||||
cli.log.info(f'Wrote {output_file.name} to {output_file}.')
|
cli.log.info(f'Wrote {output_file.name} to {output_file}.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user