From d94a0623d053ea053a861fffa6b40de76fe0f8aa Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Fri, 4 Aug 2023 15:37:42 +0200 Subject: [PATCH] Meta: Truncate generated IDL source files 3dd3120a8a15bdafc3d884878b52de37f3b60ec5 changed open mode from Write to ReadWrite, which stopped truncating files. This could be noticed by building a slightly older branch, as compiling it gave compile errors. --- .../Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp index f7ec9cc5c3..5157d053f9 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/main.cpp @@ -128,7 +128,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto write_if_changed = [&](auto generator_function, StringView file_path) -> ErrorOr { (*generator_function)(interface, output_builder); - auto output_file = TRY(Core::File::open(file_path, Core::File::OpenMode::ReadWrite)); + auto output_file = TRY(Core::File::open(file_path, Core::File::OpenMode::ReadWrite | Core::File::OpenMode::Truncate)); // Only write to disk if contents have changed auto previous_contents = TRY(output_file->read_until_eof());