summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-01-18 23:30:43 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-01-18 23:30:43 +0200
commit65eec6d2172845de81a3da7ec0fdf63d2ec1897f (patch)
treed2da2de8d7a625a043e55ef597232637907abad0 /scripts
parent305fe845c6058177c84c7f8d49c3faedec2e8282 (diff)
XML formatting tool - add LF before EOF
Diffstat (limited to 'scripts')
-rw-r--r--scripts/code_tools/fix_xml_indentations.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/code_tools/fix_xml_indentations.py b/scripts/code_tools/fix_xml_indentations.py
index 019f6db23c..9c8a1fc04b 100644
--- a/scripts/code_tools/fix_xml_indentations.py
+++ b/scripts/code_tools/fix_xml_indentations.py
@@ -79,7 +79,10 @@ def save_xml(tree, file_path, xml_decl, indent_text=False, indent_tab=False, rm_
with io.open(file_path, 'wb') as file:
file.write(xml_decl.encode('utf-8'))
file.write('\n'.encode('utf-8'))
- file.write(xml_string.encode('utf-8'))
+ if xml_string:
+ file.write(xml_string.encode('utf-8'))
+ if not xml_string.endswith('\n'):
+ file.write('\n'.encode('utf-8'))
except IOError as e:
print(f"Error saving file {file_path}: {e}")