If you need, with your application, to add a directory to the auto_path list, be certain to remember it is a list - so don't make the mistake of treating it as a single value.
Instead use something like
set auto_path [linsert $auto_path 0 /home/mystuff/someextension/unix]
lappend auto_path [file join $env(HOME) someextension unix]
Always use an absolute path, not a relative one.
Also make certain that auto_path (and env in the second case) are global references to the variables, either using global or $::
Tcl's init.tcl start up code sets auto_path as a global within an interpreter instance. As the distribution init.tcl for 8.3 says right at the top,
# The values on the path come from several locations: # # The environment variable TCLLIBPATH # # tcl_library, which is the directory containing this init.tcl script. # tclInitScript.h searches around for the directory containing this # init.tcl and defines tcl_library to that location before sourcing it. # # The parent directory of tcl_library. Adding the parent # means that packages in peer directories will be found automatically. # # Also add the directory where the executable is located, plus ../lib # relative to that path. # # tcl_pkgPath, which is set by the platform-specific initialization routines # On UNIX it is compiled in # On Windows, it is not used # On Macintosh it is "Tool Command Language" in the Extensions folder
Two points to emphasize from the above:
Question: is there a Wiki page that discusses how the whole Tcl start up, locate extension, load extension thing works? One of the toughest problems I encounter with Tcl is figuring out how to fix problems when an extension I think should load, doesn't load.
When this is a normal file system, and one does the
package require Tk package require Tix
the extension is found, loaded, and things work. When the same directory structure is used within a starkit, an error about not finding the Tix script code is generated.
Understanding the process better - and perhaps some debugging tools - would make fixing things like this easier.