summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/dltest/pkgb.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index 1a362ef..9884a64 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -99,8 +99,19 @@ Pkgb_UnsafeObjCmd(
}
#if (TCL_MAJOR_VERSION > 8)
-# define Tcl_GetDefaultEncodingDir ((const char *(*)(void)) \
- ((&(tclStubsPtr->tcl_PkgProvideEx))[341]))
+const char *Tcl_GetDefaultEncodingDir(void)
+{
+ int numDirs;
+ Tcl_Obj *first, *searchPath = Tcl_GetEncodingSearchPath();
+
+ Tcl_ListObjLength(NULL, searchPath, &numDirs);
+ if (numDirs == 0) {
+ return NULL;
+ }
+ Tcl_ListObjIndex(NULL, searchPath, 0, &first);
+
+ return Tcl_GetString(first);
+}
#endif
static int
@@ -110,10 +121,6 @@ Pkgb_DemoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- if(!Tcl_GetDefaultEncodingDir) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("not supported", -1));
- return TCL_ERROR;
- }
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetDefaultEncodingDir(), -1));
return TCL_OK;
}