Posted to tcl by patthoyts at Tue Sep 18 19:06:47 GMT 2007view raw

  1. proc tkjabber::get_cafile {} {
  2. global env
  3. set path [file join $::tkchat_dir certs.pem]
  4. if {![file exists $path]} { return {} }
  5. if {[lindex [file system $path] 0] ne "native"} {
  6. set new {}
  7. foreach var {TEMP TMP TMPDIR} {
  8. if {[info exists env($var)] \
  9. && [file isdirectory $env($var)] \
  10. && [file writable $env($var)]} then {
  11. set new [file join $env($var) tkchat.pem]
  12. break
  13. }
  14. }
  15. if {$new eq {}} {
  16. if {[file isdirectory /tmp] && [file writable /tmp]} {
  17. set new [file join /tmp tkchat.pem]
  18. } else {
  19. log::log error "cannot find a tempfile location"
  20. return {}
  21. }
  22. }
  23. log::log info "copying certificate collection to $new"
  24. file copy -force $path $new
  25. return $new
  26. }
  27. return $path
  28. }