Posted to tcl by stevel at Mon Feb 22 02:09:34 GMT 2010view raw

  1. # ::critcl2::precopy is only used on Windows when preloading out of a
  2. # VFS that doesn't support direct loading (usually, a Starkit)
  3. # - we preserve the dll name so that dependencies are satisfied
  4. # - critcl2::preload is defined in critcl/lib/critcl/critcl_c/preload.c
  5.  
  6. proc precopy {dll} {
  7. global env
  8. if {[info exists env(TEMP)]} {
  9. set dir $env(TEMP)
  10. } elseif {[info exists env(TMP)]} {
  11. set dir $env(TMP)
  12. } elseif {[info exists ~]} {
  13. set dir ~
  14. } else {
  15. set dir .
  16. }
  17. set dir [file join $dir TCL[pid]]
  18. set i 0
  19. while {[file exists $dir]} {
  20. append dir [incr i]
  21. }
  22. set new [file join $dir [file tail $dll]]
  23. file mkdir $dir
  24. file copy $dll $new
  25. return $new
  26. }