EuroTcl 2023 - Jim and Tcl interoperability, Featuring thing o_o, Georg Lehner, 2023-07-20

Determine the script directory

The following commonly recomended method to find the real path with resolving the symlink on the last element breaks with Jim:

file normalize [file dirname [info script]/...]

Reason: [info script]/... is a path which on purpose does not exist. Tcl normalizes anyway, Jim throws error because of non existing file/directory.

Alternative:

if {[catch {file readlink [info script]} Path]} {set Path [info script]}
lappend ::auto_path [file normalize [file dirname $Path]]if {![info exists argv0] || [file tail [info script]] ne [file tail $::argv0]} return