Take a look at apr_stat(). You won't have to open/close the file.
Cheers,
-g
On Tue, Oct 03, 2000 at 11:24:59PM -0000, kfogel@tigris.org wrote:
> User: kfogel
> Date: 00/10/03 16:24:59
>
> Modified: subversion/libsvn_wc entries.c local_changes.c log.c wc.h
> Log:
> (svn_wc__file_affected_time): new func.
> (set_entry): set a timestamp attribute.
>...
> --- local_changes.c 2000/09/21 23:49:25 1.6
> +++ local_changes.c 2000/10/03 23:24:58 1.7
> @@ -58,6 +58,44 @@
>
>
>
> +/*** Timestamp generation and comparision. ***/
> +
> +svn_error_t *
> +svn_wc__file_affected_time (apr_time_t *apr_time,
> + svn_string_t *path,
> + apr_pool_t *pool)
> +{
> + apr_file_t *f = NULL;
> + apr_finfo_t finfo;
> + apr_status_t apr_err;
> +
> + apr_err = apr_open (&f, path->data, APR_READ, APR_OS_DEFAULT, pool);
> + if (apr_err)
> + goto error;
> +
> + apr_err = apr_getfileinfo (&finfo, f);
> + if (apr_err)
> + goto error;
> +
> + if (finfo.mtime > finfo.ctime)
> + *apr_time = finfo.mtime;
> + else
> + *apr_time = finfo.ctime;
> +
> + apr_err = apr_close (f);
> + if (apr_err)
> + goto error;
> +
> + return SVN_NO_ERROR;
> +
> + error:
> + return svn_error_createf (apr_err, 0, NULL, pool,
> + "svn_wc__file_affected_time: %s", path->data);
> +}
> +
> +
> +
> +
--
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:10 2006