1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

Meta: Truncate generated IDL source files

3dd3120a8a 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.
This commit is contained in:
Karol Kosek 2023-08-04 15:37:42 +02:00 committed by Andreas Kling
parent 49df2e1e3a
commit d94a0623d0

View file

@ -128,7 +128,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto write_if_changed = [&](auto generator_function, StringView file_path) -> ErrorOr<void> {
(*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());