Skip to main content

Posts

Showing posts from March, 2022

Home directory for a script...

If an application has a series of Tcl script packages loaded with the source command, then any subsequent calls made by those scripts will potentially loose track of the path to find associated data files. This may not be a problem if the application will always use absolute addressing, ie. be run from its home directory, but if the application is located in the execution path, downstream proceedure calls and scripts may not know where to find obtain resources. The way around this is to keep a note of the path where the main application script is located as soon as the script begins. # !/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" set ::app(HOME) [file dirname [file normalize [info script]]] set ::app(demo) 0 set ::app(ibus,defaultIM) [exec ibus engine] source $::app(HOME)/editor_widget.tcl source $::app(HOME)/dictionary/dictionary.tcl source $::app(HOME)/translationEngine/translationEngine.tcl source $::app(HOME)/translationEngine/teGUI.tcl s