$starkit::topdir set only once
obienert <[email protected]> Mon, 15 Nov 2010 08:23:42 -0800 (PST)
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <c79a34b1-6ffa-4713-843f-d851e9df781c@y23g2000yqd.googlegroups.com> |
Hello,
Recently I had the problem of a 'package not found' issue when
sourcing a starkit from within a starkit. The kit is snodbc.kit but I
think it is a problem that may occur with other packages too because
of the startup logic in main.tcl.
This file looks like below:
if {[starkit::startup]eq"sourced"} {
if {[package vsatisfies [package provide Tcl] 8.5 ]} {
starkit::autoextend [file join $::starkit::topdir lib8.5plus]
} else {
starkit::autoextend [file join $::starkit::topdir lib8.4]
}
starkit::autoextend [file join $::starkit::topdir lib
[starkit::platform] ]
starkit::autoextend [file join $::starkit::topdir lib]
} else {
source [file join $::starkit::topdir help help.tcl]
}
When I source the kit directly, e.g. in a tkcon console, everything
works as expected. However, when I source it from within another
starkit and then try a package require snodbc, I would get a 'package
not found' error.
So I changed the above code to (Found this in: Welch, 'Practical
Programming with Tcl/Tk'):
if {[starkit::startup]eq"sourced"} {
set vfsroot [file dirname [file normalize [info script]]]
if {[package vsatisfies [package provide Tcl] 8.5 ]} {
starkit::autoextend [file join $vfsroot lib8.5plus]
} else {
starkit::autoextend [file join $vfsroot lib8.4]
}
starkit::autoextend [file join $vfsroot lib [starkit::platform] ]
starkit::autoextend [file join $vfsroot lib]
} else {
source [file join $::starkit::topdir help help.tcl]
}
I guess, this is because of starkit::topdir set only once, when
calling starkit::startup the first time. So in the case of snodbc.kit,
$starkit::topdir would not go into snodbc.vfs and package require
would fail.
By the way, at wiki.tcl.tk I did not find clear information about that
issue. Rather, at least one page described the old behavior of
starkit::topdir being updated by each loaded starkit, which is
obviously not true anymore.
Or is there a way to make starkit::startup to set starkit::topdir when
it is called?
Comments welcome,
Regards Oliver
--
You received this message because you are subscribed to the "starkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/starkit?hl=en