From aa35d3ae179ad467b592046de2e564e19fcdef8d Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 5 May 2026 14:58:26 +0800 Subject: [PATCH] preserve a single trailing newline when reformatting JSON files --- scripts/orca_filament_lib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/orca_filament_lib.py b/scripts/orca_filament_lib.py index 92f6d1dc55..65f037e3f3 100644 --- a/scripts/orca_filament_lib.py +++ b/scripts/orca_filament_lib.py @@ -132,6 +132,7 @@ def update_profile_library(vendor="",profile_type="filament"): library[profile_section] = sorted_profiles f.seek(0) json.dump(library, f, indent="\t", ensure_ascii=False) + f.write('\n') f.truncate() print(f"Profile library for {vendor} updated successfully!") @@ -230,6 +231,7 @@ def clean_up_profile(vendor="", profile_type="", force=False): f.seek(0) ordered_profile = create_ordered_profile(_profile, ['type', 'name', 'renamed_from', 'inherits', 'from', 'setting_id', 'filament_id', 'instantiation']) json.dump(ordered_profile, f, indent="\t", ensure_ascii=False) + f.write('\n') f.truncate() print(f"Updated profile: {full_path}") except Exception as e: @@ -274,6 +276,7 @@ def rename_filament_system(vendor="OrcaFilamentLibrary"): if modified: with open(full_path, 'w', encoding='utf-8') as f: json.dump(data, f, indent="\t", ensure_ascii=False) + f.write('\n') print(f"Updated {full_path}") except Exception as e: