From 86cc65a170b757aedfcc23f35cf02d3ed19f9bab Mon Sep 17 00:00:00 2001 From: Fergus Henderson Date: Sat, 7 Feb 2004 12:44:18 +0000 Subject: [PATCH] Ensure that we don't update the timestamp on the ".mh" file if Estimated hours taken: 0.5 Branches: main compiler/export.m: Ensure that we don't update the timestamp on the ".mh" file if it hasn't changed, by writing it out to .mh.tmp and then using "update_interface" to rename it to .mh. --- compiler/export.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/export.m b/compiler/export.m index 5d7361fcb..a79e57ddd 100644 --- a/compiler/export.m +++ b/compiler/export.m @@ -622,7 +622,7 @@ export__produce_header_file(ForeignExportDecls, ModuleName) --> C_ExportDecls) }, { HeaderExt = ".mh" }, module_name_to_file_name(ModuleName, HeaderExt, yes, FileName), - io__open_output(FileName, Result), + io__open_output(FileName ++ ".tmp", Result), ( { Result = ok(FileStream) } -> @@ -670,13 +670,15 @@ export__produce_header_file(ForeignExportDecls, ModuleName) --> "\n", "#endif /* ", GuardMacroName, " */\n"]), io__set_output_stream(OutputStream, _), - io__close_output(FileStream) + io__close_output(FileStream), + % rename ".mh.tmp" to ".mh". + update_interface(FileName) ; io__progname_base("export.m", ProgName), io__write_string("\n"), io__write_string(ProgName), io__write_string(": can't open `"), - io__write_string(FileName), + io__write_string(FileName ++ ".tmp"), io__write_string("' for output\n"), io__set_exit_status(1) ).