Example #1
0
file_info_t * file_query( OBJECT * const path )
{
    /* FIXME: Add tracking for disappearing files (i.e. those that can not be
     * detected by stat() even though they had been detected successfully
     * before) and see how they should be handled in the rest of Boost Jam code.
     * Possibly allow Jamfiles to specify some files as 'volatile' which would
     * make Boost Jam avoid caching information about those files and instead
     * ask the OS about them every time.
     */
    int found;
    file_info_t * const ff = file_info( path, &found );
    if ( !found )
    {
        file_query_( ff );
        if ( ff->exists )
        {
            /* Set the path's timestamp to 1 in case it is 0 or undetected to avoid
             * confusion with non-existing paths.
             */
            if ( timestamp_empty( &ff->time ) )
                timestamp_init( &ff->time, 1, 0 );
        }
    }
    if ( !ff->exists )
    {
        return 0;
    }
    return ff;
}
Example #2
0
file_info_t * file_query( OBJECT * const path )
{
    /* FIXME: Add tracking for disappearing files (i.e. those that can not be
     * detected by stat() even though they had been detected successfully
     * before) and see how they should be handled in the rest of Boost Jam code.
     * Possibly allow Jamfiles to specify some files as 'volatile' which would
     * make Boost Jam avoid caching information about those files and instead
     * ask the OS about them every time.
     *
     * FIXME: Consider returning a clear file_info() result here if
     * file_query_() fails. Should simplify the caller side error checking and
     * the caller still can and needs to detect whether the file has not been
     * successfully detected by the OS, i.e. whether the file_query() call
     * failed.
     */
    file_info_t * const ff = file_info( path );
    if ( timestamp_empty( &ff->time ) )
    {
        if ( file_query_( ff ) < 0 )
            return 0;

        /* Set the path's timestamp to 1 in case it is 0 or undetected to avoid
         * confusion with non-existing paths.
         */
        if ( timestamp_empty( &ff->time ) )
            timestamp_init( &ff->time, 1, 0 );
    }
    return ff;
}