set post_type based on custom taxonomy permalink

It turned out that the post_type was being set but for some reason it would not load the appropriate archive template. I’m suspect it has something to do with the way my post type and custom taxonomy are set up.

Here is a solution I came up with. I’m open to suggestions.

function custom_template_redirect() {
    if (is_archive() && get_post_type() != '') {
        $file = TEMPLATEPATH . '/archive-' . get_post_type() . '.php';
        if ( file_exists( $file ) ) {
            include ($file);
            exit();
        }
    }
}
add_action('template_redirect', 'custom_template_redirect');