class Gem::PathSupport

def split_gem_path(gpaths, home)

def split_gem_path(gpaths, home)
  # FIX: it should be [home, *path], not [*path, home]
  gem_path = []
  if gpaths
    gem_path = gpaths.split(Gem.path_separator)
    # Handle the path_separator being set to a regexp, which will cause
    # end_with? to error
    if gpaths =~ /#{Gem.path_separator}\z/
      gem_path += default_path
    end
    if File::ALT_SEPARATOR
      gem_path.map! do |this_path|
        this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
      end
    end
    gem_path << home
  else
    gem_path = default_path
  end
  gem_path.map {|path| expand(path) }.uniq
end