In [pkgIndex.tcl] files, a variable named ''dir'' is guaranteed to be available and hold the name of the directory in which that file resides. It is not guaranteed that this is a global variable, nor need it be related to what `[[file dirname [[info script]]]]` returns (i.e., the latter can be quite irrelevant for this situation).
This information is used to construct [package ifneeded] scripts for the packages defined, as these typically [source] or [load] the file in which the package implementation resides. It is then important that the value of ''dir'', or some value derived from this, gets embedded into the script
Examples:
package ifneeded pureTclPackage 1.0 [list source [file join $dir purePkg.tcl]]
package ifneeded compiledPackage 1.0 [list load [file join $dir compiledPkg[info sharedlibextension]]]
package ifneeded mixedPackage 1.0 "[list source [file join $dir mixedPkg.tcl]] ; [list load [file join $dir mixedPkg[info sharedlibextension]]]"
Results can be
% package ifneeded pureTclPackage 1.0
source /usr/local/lib/tcltk/misc/purePkg.tcl
% package ifneeded compiledPackage 1.0
load /usr/local/lib/tcltk/misc/compiledPkg.so
% package ifneeded mixedPackage 1.0
source /usr/local/lib/tcltk/misc/mixedPkg.tcl ; load /usr/local/lib/tcltk/misc/mixedPkg.so
See also:
* [package index script interface guidelines]
----
!!!!!!%| [Category DistributionPackage] | [Category Syntax] |%
!!!!!!