Version 3 of tlinker

Updated 2007-10-22 15:58:49 by TSP

TSP, 22th of October 2007: tlinker is a small utility script I use to attach packages to Starkits. It takes up two arguments, first being the package name, and second being the .vfs directory. Note, that the script expects for the lib directory to be already there.

 catch {package require fubar}
 if { $argc != 2 } {
         puts "Usage: tlinker <package> <project.vfs>"
         exit 1
 }

 set package [lindex $argv 0]
 set vfs     [lindex $argv 1]

 set versions [package versions $package]
 if { "$versions" == {}} {
         puts stderr "tlinker: $package: no such package"
         exit 1
 }
 set res [package ifneeded $package [lindex $versions 0]]

 set r [file tail [lindex $res 1]
 file mkdir $vfs/lib
 file copy $r $vfs/lib

RS Some notes:

  • For real platform independence, Tcl has file copy.
  • And you can make sure the directory exists by calling file mkdir - it is a no-op if it exists, and creates it otherwise.
  • The regexp seems to do the work of file tail?

TSP Hmm. I guess I should read the file manpage more carefully next time :D Applied changes (file copy, file mkdir, file tail).