TABLE OF CONTENTS


::pwtk::import

SYNOPSIS

proc ::pwtk::import {scriptFile} {

PURPOSE

Import the specified PWTK script file. This is like the Tcl source command, but handles correctly the sourcing from various directories.

ARGUMENTS

SOURCE

    variable import; # this variable is needed by ::pwtk::rsync_imports (it contains dir1 file1 dir2 file2 ...)
    variable propagate
    
    set here [pwd]
    set dir  [file dirname $scriptFile]
    set file [file tail $scriptFile]

    if { [info exists propagate(level)] && $propagate(level) > 0 } {
        # remember which files were imported (needed by ::pwtk::rsync_imports_)
        if { [file pathtype $dir] ne "relative" } {        
            lappend import $dir
        } else {
            # store dir as relative wrt $HOME
            lappend import [::fileutil::relative $::env(HOME) [file join [pwd] $dir]]
        }
        lappend import $file
    }

    cd $dir
    uplevel source $file
    cd $here
}