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

# ::critcl2::precopy is only used on Windows when preloading out of a
    # VFS that doesn't support direct loading (usually, a Starkit)
    #   - we preserve the dll name so that dependencies are satisfied
    #   - critcl2::preload is defined in critcl/lib/critcl/critcl_c/preload.c

    proc precopy {dll} {
        global env
        if {[info exists env(TEMP)]} {
            set dir $env(TEMP)
        } elseif {[info exists env(TMP)]} {
            set dir $env(TMP)
        } elseif {[info exists ~]} {
            set dir ~
        } else {
            set dir .
        }
        set dir [file join $dir TCL[pid]]
        set i 0
        while {[file exists $dir]} {
            append dir [incr i]
        }
        set new [file join $dir [file tail $dll]]
        file mkdir $dir
        file copy $dll $new
        return $new
    }