summaryrefslogtreecommitdiffstats
path: root/generic/tclZipfs.c
diff options
context:
space:
mode:
authorhypnotoad <yoda@etoyoc.com>2017-11-20 17:09:44 (GMT)
committerhypnotoad <yoda@etoyoc.com>2017-11-20 17:09:44 (GMT)
commit4e97c16367e23bcde62e1b0910c32a7d06614518 (patch)
treeb4a9616165dad657cac99e0362361fe56f9ee951 /generic/tclZipfs.c
parent280b6aa62e68db8d71bc519af2d89d05c745cfcc (diff)
downloadtcl-4e97c16367e23bcde62e1b0910c32a7d06614518.zip
tcl-4e97c16367e23bcde62e1b0910c32a7d06614518.tar.gz
tcl-4e97c16367e23bcde62e1b0910c32a7d06614518.tar.bz2
Modifications to allow the Tcl build system to exploit either a native zip
executable in the path or a tclsh that understands the new "install" keyword from the command line Added a new file to /library which is run when the user executes "tclsh install ..." Embedded in installer.tcl is a facility for building zip archives
Diffstat (limited to 'generic/tclZipfs.c')
-rw-r--r--generic/tclZipfs.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 689a648..8c852b2 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -3977,25 +3977,32 @@ int TclZipfs_AppHook(int *argc, char ***argv){
}
} else if (*argc>1) {
archive=(*argv)[1];
- fflush(stdout);
- if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) {
- int found;
+ if(strcmp(archive,"install")==0) {
+ /* If the first argument is mkzip, run the mkzip program */
Tcl_Obj *vfsinitscript;
- vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1);
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/install.tcl",-1);
Tcl_IncrRefCount(vfsinitscript);
- if(Tcl_FSAccess(vfsinitscript,F_OK)==0) {
- /* Startup script should be set before calling Tcl_AppInit */
- Tcl_SetStartupScript(vfsinitscript,NULL);
- } else {
+ Tcl_SetStartupScript(vfsinitscript,NULL);
+ } else {
+ if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) {
+ int found;
+ Tcl_Obj *vfsinitscript;
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1);
+ Tcl_IncrRefCount(vfsinitscript);
+ if(Tcl_FSAccess(vfsinitscript,F_OK)==0) {
+ /* Startup script should be set before calling Tcl_AppInit */
+ Tcl_SetStartupScript(vfsinitscript,NULL);
+ } else {
+ Tcl_DecrRefCount(vfsinitscript);
+ }
+ /* Set Tcl Encodings */
+ vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1);
+ Tcl_IncrRefCount(vfsinitscript);
+ found=Tcl_FSAccess(vfsinitscript,F_OK);
Tcl_DecrRefCount(vfsinitscript);
- }
- /* Set Tcl Encodings */
- vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1);
- Tcl_IncrRefCount(vfsinitscript);
- found=Tcl_FSAccess(vfsinitscript,F_OK);
- Tcl_DecrRefCount(vfsinitscript);
- if(found==TCL_OK) {
- return TCL_OK;
+ if(found==TCL_OK) {
+ return TCL_OK;
+ }
}
}
}