diff options
author | das <das> | 2002-10-22 16:41:26 (GMT) |
---|---|---|
committer | das <das> | 2002-10-22 16:41:26 (GMT) |
commit | cd83bd4f9b2b62007d4f9eed42dffba1e49e70f0 (patch) | |
tree | cbfa88b9d4e734767f869e6cc17264ca9d64cd7e /unix | |
parent | 5356bb251e4978b7dc52fb21ee811b516ef2329f (diff) | |
download | tcl-cd83bd4f9b2b62007d4f9eed42dffba1e49e70f0.zip tcl-cd83bd4f9b2b62007d4f9eed42dffba1e49e70f0.tar.gz tcl-cd83bd4f9b2b62007d4f9eed42dffba1e49e70f0.tar.bz2 |
* library/auto.tcl (tcl_findLibrary):
* library/package.tcl (tclPkgUnknown): on macosx, search inside the
Resources/Scripts subdirectory of any potential package directory
* macosx/Tcl.pbproj/project.pbxproj: add standard Frameworks dirs
to TCL_PACKAGE_PATH make argument.
* unix/tclUnixInit.c (TclpSetVariables): on macosx, add embedded
framework dirs to tcl_pkgPath: @executable_path/../Frameworks and
@executable_path/../PrivateFrameworks (if they exist), as well as
the dirs in DYLD_FRAMEWORK_PATH (if set). [Patch #624509]
use standard MAXPATHLEN instead of literal 1024
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixInit.c | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 092330d..5be58f5 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.33 2002/09/02 19:27:42 hobbs Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.34 2002/10/22 16:41:28 das Exp $ */ #if defined(HAVE_CFBUNDLE) @@ -404,9 +404,9 @@ CONST char *path; /* Path to the executable in native { #ifdef HAVE_CFBUNDLE - char tclLibPath[1024]; + char tclLibPath[MAXPATHLEN + 1]; - if (Tcl_MacOSXGetLibraryPath(NULL, 1024, tclLibPath) == TCL_OK) { + if (Tcl_MacOSXGetLibraryPath(NULL, MAXPATHLEN, tclLibPath) == TCL_OK) { str = tclLibPath; } else #endif /* HAVE_CFBUNDLE */ @@ -700,15 +700,60 @@ TclpSetVariables(interp) Tcl_DString ds; #ifdef HAVE_CFBUNDLE - char tclLibPath[1024]; + char tclLibPath[MAXPATHLEN + 1]; - if (Tcl_MacOSXGetLibraryPath(interp, 1024, tclLibPath) == TCL_OK) { + if (Tcl_MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) { + CONST char *str; + Tcl_DString ds; + CFBundleRef bundleRef; + Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY); Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY); Tcl_SetVar(interp, "tcl_pkgPath", " ", TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + str = TclGetEnv("DYLD_FRAMEWORK_PATH", &ds); + if ((str != NULL) && (str[0] != '\0')) { + char *p = Tcl_DStringValue(&ds); + /* convert DYLD_FRAMEWORK_PATH from colon to space separated */ + do { + if(*p == ':') *p = ' '; + } while (*p++); + Tcl_SetVar(interp, "tcl_pkgPath", Tcl_DStringValue(&ds), + TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + Tcl_SetVar(interp, "tcl_pkgPath", " ", + TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + Tcl_DStringFree(&ds); + } + if ((bundleRef = CFBundleGetMainBundle())) { + CFURLRef frameworksURL; + Tcl_StatBuf statBuf; + if((frameworksURL = CFBundleCopyPrivateFrameworksURL(bundleRef))) { + if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE, + tclLibPath, MAXPATHLEN) && + ! TclOSstat(tclLibPath, &statBuf) && + S_ISDIR(statBuf.st_mode)) { + Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, + TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + Tcl_SetVar(interp, "tcl_pkgPath", " ", + TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + } + CFRelease(frameworksURL); + } + if((frameworksURL = CFBundleCopySharedFrameworksURL(bundleRef))) { + if(CFURLGetFileSystemRepresentation(frameworksURL, TRUE, + tclLibPath, MAXPATHLEN) && + ! TclOSstat(tclLibPath, &statBuf) && + S_ISDIR(statBuf.st_mode)) { + Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, + TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + Tcl_SetVar(interp, "tcl_pkgPath", " ", + TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); + } + CFRelease(frameworksURL); + } + } Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY | TCL_APPEND_VALUE); } else |