summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInit.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-03-08 03:44:09 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-03-08 03:44:09 (GMT)
commit8579cbea202b7f81f0f89ea380112c2945e532e9 (patch)
treee207a60f35d236704456acb7560006c33e04ae94 /macosx/tkMacOSXInit.c
parent537386f4a6d884537e64d0a994b375d97d5ccf10 (diff)
downloadtk-8579cbea202b7f81f0f89ea380112c2945e532e9.zip
tk-8579cbea202b7f81f0f89ea380112c2945e532e9.tar.gz
tk-8579cbea202b7f81f0f89ea380112c2945e532e9.tar.bz2
Remove tkMacOSXLaunch.c from TIP; adds too many extraneous commands. Re-focus on URL and print events, and Services
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r--macosx/tkMacOSXInit.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 5b99371..e559bfc 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -375,7 +375,6 @@ TkpInit(
}
Tk_MacOSXServices_Init(interp);
- TkMacOSXLaunch_Init(interp);
Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel",
TkMacOSXStandardAboutPanelObjCmd, NULL, NULL);
@@ -383,6 +382,7 @@ TkpInit(
TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
TkMacOSXIconBitmapObjCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
/*
@@ -585,6 +585,44 @@ TkMacOSXGetStringObjFromCFString(
}
return obj;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetAppPath --
+ *
+ * Retrieves the path to the current installed Wish application.
+ *
+ * Results:
+ * Returns the application name path.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]) {
+
+ CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+
+
+ /* Convert the URL reference into a string reference. */
+ CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
+
+ /* Get the system encoding method. */
+ CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
+
+ /* Convert the string reference into a C string. */
+ char *path = CFStringGetCStringPtr(appPath, encodingMethod);
+
+ Tcl_SetResult(ip, path, NULL);
+
+ CFRelease(mainBundleURL);
+ CFRelease(appPath);
+ return TCL_OK;
+
+}
/*
* Local Variables: