# File vtk/tk/vtkLoadRubyTkWidgets.rb, line 4
def Vtk.LoadRubyTkWidgets
??
  name = 'vtkRenderingRubyTkWidgets'
  pkgname = name.downcase.capitalize

  # find out if the file is already loaded
  loaded = Tk.tk_call('info', 'loaded')
  if loaded.include?(pkgname)
    return false
  end

  # create the platform-dependent file name
  prefix = ''
  if Config::CONFIG['arch']=~/linux/
    prefix = 'lib'
  end
  extension = Tk.tk_call('info', 'sharedlibextension')
  filename = prefix+name+extension

  # create an extensive list of paths to search
  pathlist = $LOAD_PATH
  # add tcl paths, ensure that {} is handled properly
  auto_paths = Tk::AUTO_PATH.to_a
  pathlist += auto_paths

  # a common place for these sorts of things  
  if Config::CONFIG['arch']=~/linux/
    pathlist += ['/usr/local/lib']
  end

  # attempt to load
  for path in pathlist
    fullpath = File.join(path, filename)
    begin
      Tk.load_tcllibrary(fullpath, pkgname)
      return true
    rescue
      next
    end
  end

  # re-generate the error
  Tk.tk_call('load', filename)
  return nil
end