summaryrefslogtreecommitdiff
path: root/ccode
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-02-24 22:22:21 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2017-04-30 18:29:19 +0200
commit3c8489c202692a230914ede35320ced13a9fe05b (patch)
tree6d257be587e6d4ccb8c079da92ec5afb19ba9259 /ccode
parentef50a4259393c64c6beb36dd96e60d185da22fdd (diff)
downloadvala-3c8489c202692a230914ede35320ced13a9fe05b.tar.gz
codewriter: Update timestamps of generated c-files if needed
If a changed source-file produces the same ccode we currently leave existing files untouched. Although it is better to update the modification timestamp of those to at least meet the one of associated source-file. https://bugzilla.gnome.org/show_bug.cgi?id=683286
Diffstat (limited to 'ccode')
-rw-r--r--ccode/valaccodewriter.vala8
1 files changed, 8 insertions, 0 deletions
diff --git a/ccode/valaccodewriter.vala b/ccode/valaccodewriter.vala
index 281ff6e43..2e58a41b3 100644
--- a/ccode/valaccodewriter.vala
+++ b/ccode/valaccodewriter.vala
@@ -138,6 +138,14 @@ public class Vala.CCodeWriter {
FileUtils.rename (temp_filename, filename);
} else {
FileUtils.unlink (temp_filename);
+ if (source_filename != null) {
+ var stats = Stat (source_filename);
+ var target_stats = Stat (filename);
+ if (stats.st_mtime >= target_stats.st_mtime) {
+ UTimBuf timebuf = { stats.st_atime + 1, stats.st_mtime + 1 };
+ FileUtils.utime (filename, timebuf);
+ }
+ }
}
}
}