'Find the relative path to data type converters and display applications included
in installed tool shed repositories.'

def get_converter_and_display_paths(self, registration_elem, relative_install_dir):

    converter_path = None
    display_path = None
    for elem in registration_elem.findall('datatype'):
        if (not converter_path):
            for converter in elem.findall('converter'):
                converter_config = converter.get('file', None)
                if converter_config:
                    converter_config_file_name = basic_util.strip_path(converter_config)
                    for (root, dirs, files) in os.walk(relative_install_dir):
                        if (root.find('.hg') < 0):
                            for name in files:
                                if (name == converter_config_file_name):
                                    converter_path = os.path.abspath(root)
                                    break
                if converter_path:
                    break
        if (not display_path):
            for display_app in elem.findall('display'):
                display_config = display_app.get('file', None)
                if display_config:
                    display_config_file_name = basic_util.strip_path(display_config)
                    for (root, dirs, files) in os.walk(relative_install_dir):
                        if (root.find('.hg') < 0):
                            for name in files:
                                if (name == display_config_file_name):
                                    display_path = os.path.abspath(root)
                                    break
                if display_path:
                    break
        if (converter_path and display_path):
            break
    return (converter_path, display_path)
