diff options
author | wolfsuit <wolfsuit> | 2001-11-11 17:54:40 (GMT) |
---|---|---|
committer | wolfsuit <wolfsuit> | 2001-11-11 17:54:40 (GMT) |
commit | 2c952bc4242e335e5c6137956a3b0924bc2511a1 (patch) | |
tree | dcd1f4b149eb111e84b7eeb3e6443a1e92ed7f5f | |
parent | b91aa7c18939b08a63e3db0ae724733518810b1e (diff) | |
download | tk-2c952bc4242e335e5c6137956a3b0924bc2511a1.zip tk-2c952bc4242e335e5c6137956a3b0924bc2511a1.tar.gz tk-2c952bc4242e335e5c6137956a3b0924bc2511a1.tar.bz2 |
Move the bundle routines over to Tcl, and use them from there.
-rw-r--r-- | macosx/tkMacOSXAppInit.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 82 |
2 files changed, 10 insertions, 84 deletions
diff --git a/macosx/tkMacOSXAppInit.c b/macosx/tkMacOSXAppInit.c index 501a1a3..ee70f79 100644 --- a/macosx/tkMacOSXAppInit.c +++ b/macosx/tkMacOSXAppInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXAppInit.c,v 1.1.2.3 2001/10/19 07:14:18 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXAppInit.c,v 1.1.2.4 2001/11/11 17:54:40 wolfsuit Exp $ */ #include <pthread.h> #include "tk.h" @@ -195,8 +195,8 @@ Tcl_AppInit(interp) char tclLibPath[MAX_PATH_LEN], tkLibPath[MAX_PATH_LEN]; Tcl_Obj *pathPtr; - Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tcllibrary", - tclLibPath, MAX_PATH_LEN, 0); + Tcl_MacOSXOpenBundleResources (interp, "com.tcltk.tcllibrary", + 0, MAX_PATH_LEN, tclLibPath); if (tclLibPath[0] != '\0') { Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY); @@ -209,8 +209,8 @@ Tcl_AppInit(interp) return TCL_ERROR; } - Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tklibrary", - tkLibPath, MAX_PATH_LEN, 1); + Tcl_MacOSXOpenBundleResources (interp, "com.tcltk.tklibrary", + 1, MAX_PATH_LEN, tkLibPath); /* * FIXME: This is currently a hack... I set the tcl_library, and @@ -223,7 +223,7 @@ Tcl_AppInit(interp) if (tclLibPath[0] != '\0') { pathPtr = Tcl_NewStringObj(tclLibPath, -1); } else { - Tcl_Obj *pathPtr = TclGetLibraryPath(); + pathPtr = TclGetLibraryPath(); } if (tkLibPath[0] != '\0') { diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index ce1e0fd..14634ff 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.1.2.1 2001/10/15 09:22:00 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.1.2.2 2001/11/11 17:54:40 wolfsuit Exp $ */ #include "tkInt.h" @@ -56,8 +56,8 @@ TkpInit(interp) * FIXME: Should we come up with a more generic way of doing this? */ - result = Tk_MacOSXOpenBundleResources(interp, "com.tcltk.tklibrary", - tkLibPath, 1024, 1); + result = Tcl_MacOSXOpenBundleResources(interp, "com.tcltk.tklibrary", + 1, 1024, tkLibPath); if (result != TCL_ERROR) { Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY); @@ -134,78 +134,4 @@ TkpDisplayWarning(msg, title) Tcl_WriteChars(errChannel, msg, -1); Tcl_WriteChars(errChannel, "\n", 1); } -} - -/* - *---------------------------------------------------------------------- - * - * Tk_MacOSXOpenBundleResources -- - * - * Given the bundle name for a shared library, this routine - * sets libraryVarName to the Resources/Scripts directory - * in the framework package. If hasResourceFile is - * true, it will also open the main resource file for the bundle. - * - * FIXME: This should probably be in Tcl, but the resource stuff - * isn't in Darwin, and I haven't figured out how to sort out Darwin, - * the Unix side of Tcl, and the MacOS X side of Tcl. - * - * Results: - * Standard Tcl result. - * - * Side effects: - * libraryVariableName may be set, and the resource file opened. - * - *---------------------------------------------------------------------- - */ - -int -Tk_MacOSXOpenBundleResources(Tcl_Interp *interp, - char *bundleName, - char *libraryPath, - int maxPathLen, - int hasResourceFile) -{ - CFBundleRef bundleRef; - CFStringRef bundleNameRef; - - libraryPath[0] = '\0'; - - bundleNameRef = CFStringCreateWithCString(NULL, - bundleName, kCFStringEncodingUTF8); - - bundleRef = CFBundleGetBundleWithIdentifier(bundleNameRef); - CFRelease(bundleNameRef); - - if (bundleRef == 0) { - return TCL_ERROR; - } else { - CFURLRef libURL; - - if (hasResourceFile) { - short refNum; - refNum = CFBundleOpenBundleResourceMap(bundleRef); - } - - libURL = CFBundleCopyResourceURL(bundleRef, - CFSTR("Scripts"), - NULL, - NULL); - - if (libURL != NULL) { - /* - * FIXME: This is a quick fix, it is probably not right - * for internationalization. - */ - - if (CFURLGetFileSystemRepresentation (libURL, true, - libraryPath, maxPathLen)) { - } - CFRelease(libURL); - } else { - return TCL_ERROR; - } - } - - return TCL_OK; -} +}
\ No newline at end of file |