def inject_import_path(path, options = {})
      path = path.to_s unless path.is_a?(String)
      if path =~ /(.*?)\/.*/
        import_name = Regexp.last_match[1].downcase.to_sym
        if import_name == :origen || import_name == :origen_core || Origen.app.plugins.names.include?(import_name) ||
           import_name == :doc_helpers
          # Special case to allow a shortcut for this common import plugin and to also handle legacy
          # code from when it was called doc_helpers instead of origen_doc_helpers
          if import_name == :doc_helpers
            root = Origen.app(:origen_doc_helpers).root
          else
            unless import_name == :origen || import_name == :origen_core
              root = Origen.app(import_name).root
            end
          end
          if options[:type] == :template
            if import_name == :origen || import_name == :origen_core
              path.sub! 'origen', "#{Origen.top}/templates/shared"
            else
              path.sub! Regexp.last_match[1], "#{root}/templates/shared"
            end
          else
            fail 'Unknown import path type!'
          end
        end
      end
      path
    end
def inject_import_path(path, options = {})
      path = path.to_s unless path.is_a?(String)
      if path =~ /(.*?)\/.*/
        import_name = Regexp.last_match[1].downcase.to_sym
        if import_name == :origen || import_name == :origen_core || Origen.app.plugins.names.include?(import_name) ||
           import_name == :doc_helpers
          # Special case to allow a shortcut for this common import plugin and to also handle legacy
          # code from when it was called doc_helpers instead of origen_doc_helpers
          if import_name == :doc_helpers
            root = Origen.app(:origen_doc_helpers).root
          else
            unless import_name == :origen || import_name == :origen_core
              root = Origen.app(import_name).root
            end
          end
          if options[:type] == :template
            if import_name == :origen || import_name == :origen_core
              path.sub! 'origen', "#{Origen.top}/templates/shared"
            else
              path.sub! Regexp.last_match[1], "#{root}/templates/shared"
            end
          else
            fail 'Unknown import path type!'
          end
        end
      end
      path
    end
If the current path looks like it is a reference to an import, the
 path will be replaced with the absolute path to the local import directory