home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / tcl / 1014 < prev    next >
Encoding:
Text File  |  1992-07-21  |  2.5 KB  |  63 lines

  1. Newsgroups: comp.lang.tcl
  2. Path: sparky!uunet!walter!grumpy!bytor
  3. From: bytor@grumpy.bellcore.com (Ross Huitt)
  4. Subject: Installation/Distribution Problems
  5. Message-ID: <1992Jul21.150227.18823@walter.bellcore.com>
  6. Sender: bytor@grumpy (Ross Huitt)
  7. Nntp-Posting-Host: grumpy.ctt.bellcore.com
  8. Organization: Bellcore
  9. Date: Tue, 21 Jul 92 15:02:27 GMT
  10. Lines: 51
  11.  
  12. I've not had problems with installations but I have had problems with distribution.
  13. It is really not practical for me to require that users of my prototypes install
  14. the full Tk/Tcl/... configuration just to run my software. So, I ship binaries.
  15. This leads to problems in that they likely don't have Tcl/Tk installed so the script
  16. libraries aren't present. So, I ship the binaries along. Of course, I can't have
  17. them worry about them putting the scripts in the same place I installed mine. My solution
  18. to this particular solution, although temporary, is a step in the right direction.
  19. I have essentially extended the init command in main.c for Tk to check for environment
  20. variables if the script directories don't exist. If the environment variables don't
  21. exist, it defaults to the current directory. (I'll probably add the ability to check for
  22. other common locations for the script libraries. )  It is not unreasonable to have
  23. users of my software specify some extra environment variables before running it, so this
  24. is proving to be a very viable solution.
  25.  
  26. One request to John O.:  _Please_ make the Tcl Library a variable (maybe $tcl_library)
  27. in the next release. Keep [info library] around for compatibility but have it just return
  28. $tcl_library. I _hate_ having to replace the info command just to reset the tcl library
  29. location.
  30.  
  31. My new init_cmd[] for wish is attached below. Enjoy.
  32.  
  33. char initCmd[] = "\
  34. set tcl_library [info library]; \
  35. if ![file isdirectory $tcl_library] { \
  36.         if [info exists env(TCL_LIBRARY)] { set tcl_library $env(TCL_LIBRARY) \
  37.         } else { \
  38.         set tcl_library [pwd]; \
  39.         }; \
  40.         rename info old.info.proc; \
  41.         proc info {args} { \
  42.                 global tcl_library; \
  43.                 if [llength $args]==1&&![string compare library [lindex $args 0]] { \
  44.                         return $tcl_library; \
  45.                 } else { \
  46.                         return [eval \"old.info.proc $args\"] \
  47.                 } \
  48.         } \
  49. }; \
  50. if ![file isdirectory $tk_library] { \
  51.         if [info exists env(TK_LIBRARY)] { set tk_library $env(TK_LIBRARY); \
  52.         } else { \
  53.         set tk_library [pwd] \
  54.         } \
  55. }; \
  56. source $tk_library/wish.tcl \
  57. ";
  58.  
  59.  
  60. Ross Huitt
  61. bytor@ctt.bellcore.com
  62.  
  63.