is there a nicer way to set the Tcl module path?
From Newsgroup: comp.lang.tcl
I like using Tcl modules for my apps.
I also often use soft links so that for example, an app in, say, ~/app/tcl/myapp
will be soft linked to a dir in my $PATH e.g.,
cd ~/bin ; ln -s ~/app/tcl/myapp/myapp.tcl
This means that [info script] will return different paths depending
on whether the app is run in its own dir, ./myapp.tcl or via the
soft link.
So I begin my apps like this:
#!/usr/bin/env tclsh9
if {![catch {file readlink [info script]} name]} {
const APPPATH [file dirname $name]
} else {
const APPPATH [file normalize [file dirname [info script]]]
}
tcl::tm::path add $APPPATH
package require app
app::main
Is there a nicer (and more compact) way to set APPPATH?
--- Synchronet 3.21a-Linux NewsLink 1.2