TOC PREV NEXT INDEX

 


Accessing Files from a Shared Directory


Files shared by multiple applications or projects are typically put in a shared directory, often on a file server. An application myscript.tcl might then access those files as follows:


set shared {Z:\tcl\common}
source [file join $shared help.tcl]
source [file join $shared display.tcl]

Unfortunately, because of the absolute pathname, the code above no longer works if you wrap the files in the shared directory with the application.

However, you can easily modify this code to work either unwrapped or wrapped by testing to see whether the application is wrapped and modifying the value of shared appropriately. For example:


if {[info exist tcl_platform(isWrapped)]} {
    set shared common
} else {
    set shared {Z:\tcl\common}
}
source [file join $shared help.tcl]
source [file join $shared display.tcl]

You would then need to wrap the shared files using the relativeto flag as in the following example:


C:> prowrap myscript.tcl -relativeto Z:\tcl Z:\tcl\common\*.tcl



http://www.ajubasolutions.com
Voice: (650) 210-0100
Fax: (650) 210-0101
support@ajubasolutions.com
TOC PREV NEXT INDEX