From ddb61d4a3506d933c0b216bc10e7e4bbe0141cfb Mon Sep 17 00:00:00 2001 From: Vincent Gao Date: Thu, 18 Jun 2026 20:48:58 +0200 Subject: [PATCH] fix: ensure to_file() output ends with trailing newline POSIX-conformant text files should end with a newline character. For example, concatenating two OFFXML files with cat squishes the closing tag of the first with the opening tag of the second. Add a trailing newline to the XML output written by to_file(). Fixes: #1761 Signed-off-by: Vincent Gao --- openff/toolkit/typing/engines/smirnoff/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openff/toolkit/typing/engines/smirnoff/io.py b/openff/toolkit/typing/engines/smirnoff/io.py index ba36ddc1c..6ace2f873 100644 --- a/openff/toolkit/typing/engines/smirnoff/io.py +++ b/openff/toolkit/typing/engines/smirnoff/io.py @@ -167,7 +167,7 @@ def to_file(self, file_path, smirnoff_data): """ xml_string = self.to_string(smirnoff_data) with open(file_path, "w") as of: - of.write(xml_string) + of.write(xml_string + "\n") def to_string(self, smirnoff_data: dict) -> str: """