2
0

tmpfile.tcl 403 B

123456789101112131415
  1. set ::tmpcounter 0
  2. set ::tmproot "./tests/tmp"
  3. file mkdir $::tmproot
  4. # returns a dirname unique to this process to write to
  5. proc tmpdir {basename} {
  6. set dir [file join $::tmproot $basename.[pid].[incr ::tmpcounter]]
  7. file mkdir $dir
  8. set _ $dir
  9. }
  10. # return a filename unique to this process to write to
  11. proc tmpfile {basename} {
  12. file join $::tmproot $basename.[pid].[incr ::tmpcounter]
  13. }