Skip to content

Commit

Permalink
Make calls early to find the script library in zipfs archive and alert
Browse files Browse the repository at this point in the history
the Tcl library to its location so that all interps find it when created.
  • Loading branch information
dgp committed Nov 13, 2023
1 parent 7bb4d60 commit 4c391a1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions generic/tclZipfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6453,6 +6453,7 @@ TclZipfs_AppHook(
Tcl_DecrRefCount(vfsInitScript);
if (found == TCL_OK) {
zipfs_literal_tcl_library = ZIPFS_TCL_LIBRARY_1;
Tcl_DecrRefCount(TclZipfs_TclLibrary());
return version;
}
}
Expand All @@ -6479,7 +6480,7 @@ TclZipfs_AppHook(
* wants it.
*/

TclZipfs_TclLibrary();
Tcl_DecrRefCount(TclZipfs_TclLibrary());
TclNewLiteralStringObj(vfsInitScript,
ZIPFS_TCL_LIBRARY_3 "install.tcl");
Tcl_IncrRefCount(vfsInitScript);
Expand All @@ -6491,6 +6492,17 @@ TclZipfs_AppHook(
int found;
Tcl_Obj *vfsInitScript;

/* Set Tcl Encodings */
TclNewLiteralStringObj(vfsInitScript,
ZIPFS_TCL_LIBRARY_1 "/init.tcl");
Tcl_IncrRefCount(vfsInitScript);
found = Tcl_FSAccess(vfsInitScript, F_OK);
Tcl_DecrRefCount(vfsInitScript);
if (found == TCL_OK) {
zipfs_literal_tcl_library = ZIPFS_TCL_LIBRARY_1;
Tcl_DecrRefCount(TclZipfs_TclLibrary());
}

TclNewLiteralStringObj(vfsInitScript, ZIPFS_APP_MOUNT "/main.tcl");
Tcl_IncrRefCount(vfsInitScript);
if (Tcl_FSAccess(vfsInitScript, F_OK) == 0) {
Expand All @@ -6502,14 +6514,8 @@ TclZipfs_AppHook(
} else {
Tcl_DecrRefCount(vfsInitScript);
}
/* Set Tcl Encodings */
TclNewLiteralStringObj(vfsInitScript,
ZIPFS_TCL_LIBRARY_1 "/init.tcl");
Tcl_IncrRefCount(vfsInitScript);
found = Tcl_FSAccess(vfsInitScript, F_OK);
Tcl_DecrRefCount(vfsInitScript);

if (found == TCL_OK) {
zipfs_literal_tcl_library = ZIPFS_TCL_LIBRARY_1;
return version;
}
}
Expand Down

0 comments on commit 4c391a1

Please sign in to comment.