pkgIndex.tcl 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # Tcl package index file for units package
  2. #
  3. # This file is sourced either when an application starts up or by a
  4. # "package unknown" script. It invokes the "package ifneeded" command
  5. # to set up package-related information so that packages will be
  6. # loaded automatically in response to "package require" commands.
  7. # When this script is sourced, the variable $dir must contain the full
  8. # path name of this file's directory.
  9. #
  10. # This particular index file first looks for a binary shared library,
  11. # then the Tcl-only implementation. If the shared library is found,
  12. # it is loaded. Otherwise the (default) Tcl implementation is
  13. # sourced. This style is based on the BLT package.
  14. proc units_makepkgindex { dir } {
  15. set suffix [info sharedlibextension]
  16. set binary_library [file join $dir units$suffix]
  17. set tcl_library [file join $dir units.tcl]
  18. if { [file exists $binary_library] } {
  19. package ifneeded units 1.0 [list load $binary_library]
  20. } else {
  21. package ifneeded units 1.0 [list source $tcl_library]
  22. }
  23. }
  24. units_makepkgindex $dir
  25. rename units_makepkgindex ""