From 2aebbf84606fa6fa5a014ac288eef9bc5d63402e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Feb 2009 14:02:00 +0100 Subject: directory: added "mtime" property Remember the modification time of each directory. This is important for archives (which are virtual directories right now), but may also be useful for an automatic update mechanism. --- src/update.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/update.c') diff --git a/src/update.c b/src/update.c index d03fc7cb..78929f7d 100644 --- a/src/update.c +++ b/src/update.c @@ -360,10 +360,12 @@ update_archive_tree(struct directory *directory, char *name) * * @param parent the parent directory the archive file resides in * @param name the UTF-8 encoded base name of the archive file + * @param st stat() information on the archive file * @param plugin the archive plugin which fits this archive type */ static void update_archive_file(struct directory *parent, const char *name, + const struct stat *st, const struct archive_plugin *plugin) { char *path_fs; @@ -393,6 +395,8 @@ update_archive_file(struct directory *parent, const char *name, directory->device = DEVICE_INARCHIVE; } + directory->mtime = st->st_mtime; + plugin->scan_reset(file); while ((filepath = plugin->scan_next(file)) != NULL) { @@ -438,7 +442,7 @@ update_regular_file(struct directory *directory, } #ifdef ENABLE_ARCHIVE } else if ((archive = archive_plugin_from_suffix(suffix))) { - update_archive_file(directory, name, archive); + update_archive_file(directory, name, st, archive); #endif } } @@ -593,6 +597,8 @@ updateDirectory(struct directory *directory, const struct stat *st) closedir(dir); + directory->mtime = st->st_mtime; + return true; } -- cgit v1.2.3