OK, I think I know what the problem might be. The auto_path
is a Tcl list of directories — the code that uses it iterates over the list with foreach
— that are searched for packages (and auto-loaded scripts, an old mechanism that I think is rather more trouble than it's worth). Yet you're using a single element, the output of that file join
. This wouldn't usually matter on platforms other than Windows, as the directory separator is /
there (and that's just an ordinary non-whitespace character to Tcl) but on Windows the directory separator is \
and that's a list metasyntax character to Tcl.
What does this mean? Well, after:
set ::auto_path [file join {C:\Tcl\lib}]
We can ask what the things of that list are. For example, we can print the first element of the list…
puts [lindex $::auto_path 0]
What does that output? Probably this:
C:Tcllib
OOooops! The backslashes have been taken as quoting characters, leaving an entirely non-functioning path. That won't work.
The fix is to use a different way to construct the auto_path
. I think you'll find that this does what you actually want:
set ::auto_path [list {C:\Tcl\lib}]
Though this is an alternative (still using list
; it's best for trouble-free list construction in all cases):
set ::auto_path [list [file normalize {C:\Tcl\lib}]]
(My bet is that you're trying to use file join
as a ghetto file normalize
. Don't do that. It's been poor practice for a long time now, especially now that we have a command that actually does do what you want.)