proc fileOK {win execproc} {
  

  # might not have a valid selection, so catch the selection
  catch {  selInsert $win [lindex [selection get] 0] }

  set f [lindex [$win.sel get] 0]
  if [file isdirectory $f] {
    #set f [file dirname $f]
    #set f [file dirname $f]
    cd $f
    set f [pwd]
    $win.td.d.dir delete 0 end
    $win.td.d.dir insert 0 $f
    fillLst $win [$win.td.d.fil get] $f
  } else {
    # we don't know if a file is really there or not, let the execproc
    # figure it out.  also, window is passed if execproc wants to kill it.
    # execproc can have arg(s) appended, as long as they are single or
    # properly escaped
    eval $execproc $win $f 
  }
}

