summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhypnotoad <yoda@etoyoc.com>2017-11-21 16:49:24 (GMT)
committerhypnotoad <yoda@etoyoc.com>2017-11-21 16:49:24 (GMT)
commit8225859a93e2e55934b39855a9f4f736555bc474 (patch)
tree7d2c22829b474aab47b8909d1b078a816b7af72c /generic
parent35adf8c728b9c0592670777b6beada9fdd6efa70 (diff)
downloadtcl-8225859a93e2e55934b39855a9f4f736555bc474.zip
tcl-8225859a93e2e55934b39855a9f4f736555bc474.tar.gz
tcl-8225859a93e2e55934b39855a9f4f736555bc474.tar.bz2
Eliminated the need for a preinit script in Tip 430's AppHook.
tcl_findLibrary now knows to scan the dll offered up by [info loaded] to see if an attached zipfile could possibly contain the files the extension is looking for.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclZipfs.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 03170a1..fa5b1a3 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -1013,7 +1013,6 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt,
Tcl_HashEntry *hPtr;
Tcl_DString ds, fpBuf;
unsigned char *q;
-
ReadLock();
if (!ZipFS.initialized) {
if (interp != NULL) {
@@ -1436,7 +1435,8 @@ static int
ZipFSRootObjCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
{
- return Tcl_NewStringObj(ZIPFS_VOLUME, -1);
+ Tcl_SetObjResult(interp,Tcl_NewStringObj(ZIPFS_VOLUME, -1));
+ return TCL_OK;
}
/*
@@ -3920,6 +3920,9 @@ ToUtf(
static int TclZipfs_AppHook_FindTclInit(const char *archive){
Tcl_Obj *vfsinitscript;
int found;
+ if(zipfs_literal_tcl_library) {
+ return TCL_ERROR;
+ }
if(TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) {
/* Either the file doesn't exist or it is not a zip archive */
return TCL_ERROR;
@@ -3963,36 +3966,6 @@ int TclZipfs_AppHook(int *argc, char ***argv)
** and failing that, look for a file name CFG_RUNTIME_ZIPFILE adjacent to the
** executable
*/
- TclSetPreInitScript(
-"foreach {path} {\n"
-" {" ZIPFS_APP_MOUNT "/tcl_library}\n"
-" {" ZIPFS_ZIP_MOUNT "/tcl_library}\n"
-"} {\n"
-" if {![file exists [file join $path init.tcl]]} continue\n"
-" set ::tcl_library $path\n"
-" break\n"
-"}\n"
-"if {![info exists ::tcl_library] || $::tcl_library eq {}} {\n"
-" set zipfile [file join [file dirname [info nameofexecutable]] " CFG_RUNTIME_ZIPFILE "]\n"
-" if {[file exists $zipfile]} {\n"
-" zipfs mount $zipfile {" ZIPFS_ZIP_MOUNT "}\n"
-" if {[file exists [file join {" ZIPFS_ZIP_MOUNT "} init.tcl]]} \{\n"
-" set ::tcl_library {" ZIPFS_ZIP_MOUNT "}\n"
-" } else {\n"
-" zipfs unmount {" ZIPFS_ZIP_MOUNT "}\n"
-" }\n"
-" }\n"
-"}\n"
-"foreach {path} {\n"
-" {" ZIPFS_APP_MOUNT "/tk_library}\n"
-" {" ZIPFS_ZIP_MOUNT "/tk_library}\n"
-" {" ZIPFS_VOLUME "lib/tk/tk_library}\n"
-"} {\n"
-" if {![file exists [file join $path init.tcl]]} continue\n"
-" set ::tk_library $path\n"
-" break\n"
-"}\n"
- );
if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) {
int found;
Tcl_Obj *vfsinitscript;
@@ -4062,7 +4035,9 @@ int TclZipfs_AppHook(int *argc, char ***argv)
}
Tcl_Obj *TclZipfs_TclLibrary(void) {
- if(!zipfs_literal_tcl_library) {
+ if(zipfs_literal_tcl_library) {
+ return Tcl_NewStringObj(zipfs_literal_tcl_library,-1);
+ } else {
#if defined(_WIN32) || defined(_WIN64)
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];