Posted to tcl by Stu at Sun Feb 01 02:29:27 GMT 2026view raw

  1. + /* parent/lib */
  2. + Tcl_Obj *dirs[3] = {NULL, NULL, NULL}; /* exedir, exedirparent, lib */
  3. + Tcl_Size dirCount = TclGetObjExecutableAncestors(interp, 2, dirs);
  4. + if (dirCount == 2) {
  5. + assert(dirs[1]);
  6. + dirs[2] = Tcl_NewStringObj("lib", 3);
  7. + Tcl_IncrRefCount(dirs[2]);
  8. + objPtr = TclJoinPath(2, &dirs[1], 0);
  9. + if (objPtr != NULL) {
  10. + /* Note: TclListObjAppendIfAbsent handles 0 and non-0 ref counts */
  11. + (void) TclListObjAppendIfAbsent(NULL, autoPathPtr, objPtr);
  12. + }
  13. + }
  14. + for (size_t i = 0; i < sizeof(dirs) / sizeof(dirs[0]); ++i) {
  15. + if (dirs[i] != NULL) {
  16. + Tcl_DecrRefCount(dirs[i]);
  17. + }
  18. + }
  19.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week