summaryrefslogtreecommitdiffstats
path: root/tests/support/tmpfile.tcl
blob: 809f587306c68f6adeceba36fcbd30d90782c5a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
set ::tmpcounter 0
set ::tmproot "./tests/tmp"
file mkdir $::tmproot

# returns a dirname unique to this process to write to
proc tmpdir {basename} {
    set dir [file join $::tmproot $basename.[pid].[incr ::tmpcounter]]
    file mkdir $dir
    set _ $dir
}

# return a filename unique to this process to write to
proc tmpfile {basename} {
    file join $::tmproot $basename.[pid].[incr ::tmpcounter]
}