summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclZipfs.c13
-rw-r--r--tests/zipfs.test24
2 files changed, 14 insertions, 23 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 239ca56..910ba53 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -83,8 +83,8 @@ static const z_crc_t* crc32tab;
#define ZIPFS_VOLUME "//zipfs:/"
#define ZIPFS_VOLUME_LEN 9
-#define ZIPFS_APP_MOUNT "//zipfs:/app"
-#define ZIPFS_ZIP_MOUNT "//zipfs:/lib/tcl"
+#define ZIPFS_APP_MOUNT ZIPFS_VOLUME "app"
+#define ZIPFS_ZIP_MOUNT ZIPFS_VOLUME "lib/tcl"
#define ZIPFS_FALLBACK_ENCODING "cp437"
/*
@@ -3670,22 +3670,13 @@ ZipFSExistsObjCmd(
{
char *filename;
int exists;
- Tcl_DString ds;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "filename");
return TCL_ERROR;
}
- /*
- * Prepend ZIPFS_VOLUME to filename, eliding the final /
- */
-
filename = Tcl_GetString(objv[1]);
- Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN - 1);
- Tcl_DStringAppend(&ds, filename, -1);
- filename = Tcl_DStringValue(&ds);
ReadLock();
exists = ZipFSLookup(filename) != NULL;
diff --git a/tests/zipfs.test b/tests/zipfs.test
index 8c98697..202d104 100644
--- a/tests/zipfs.test
+++ b/tests/zipfs.test
@@ -82,14 +82,14 @@ test zipfs-0.9 {zipfs basics: glob} -constraints zipfslib -body {
glob -nocomplain -tails -types f -dir $tcl_library http*
} -result {}
test zipfs-0.10 {zipfs basics: join} -constraints {zipfs zipfslib} -body {
- file join [zipfs root] bar baz
-} -result "[zipfs root]bar/baz"
+ file join ${ziproot} bar baz
+} -result "${ziproot}bar/baz"
test zipfs-0.11 {zipfs basics: join} -constraints {zipfs zipfslib} -body {
- file normalize [zipfs root]
-} -result "[zipfs root]"
+ file normalize ${ziproot}
+} -result "${ziproot}"
test zipfs-0.12 {zipfs basics: join} -constraints {zipfs zipfslib} -body {
- file normalize [zipfs root]//bar/baz//qux/../
-} -result "[zipfs root]bar/baz"
+ file normalize ${ziproot}//bar/baz//qux/../
+} -result "${ziproot}bar/baz"
test zipfs-1.3 {zipfs errors} -constraints zipfs -returnCodes error -body {
zipfs mount a b c d e f
@@ -135,8 +135,8 @@ test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body {
zipfs list -glob ${ziproot}abc/cp850.*
} -cleanup {
cd $CWD
-} -result "[zipfs root]abc/cp850.enc"
-testConstraint zipfsenc [zipfs exists /abc/cp850.enc]
+} -result "${ziproot}abc/cp850.enc"
+testConstraint zipfsenc [zipfs exists ${ziproot}abc/cp850.enc]
test zipfs-2.3 {zipfs info} -constraints {zipfs zipfsenc} -body {
set r [zipfs info ${ziproot}abc/cp850.enc]
lrange $r 0 2
@@ -166,7 +166,7 @@ S
00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0
} ;# FIXME: result depends on content of encodings dir
test zipfs-2.5 {zipfs exists} -constraints {zipfs zipfsenc} -body {
- zipfs exists /abc/cp850.enc
+ zipfs exists ${ziproot}abc/cp850.enc
} -result 1
test zipfs-2.6 {zipfs unmount while busy} -constraints {zipfs zipfsenc} -body {
zipfs unmount /abc
@@ -190,8 +190,8 @@ test zipfs-2.8 {zipfs mkzip} -constraints zipfs -body {
zipfs list -glob ${ziproot}def/cp850.*
} -cleanup {
cd $CWD
-} -result "[zipfs root]def/cp850.enc"
-testConstraint zipfsencbuf [zipfs exists /def/cp850.enc]
+} -result "${ziproot}def/cp850.enc"
+testConstraint zipfsencbuf [zipfs exists ${ziproot}def/cp850.enc]
test zipfs-2.9 {zipfs info} -constraints {zipfs zipfsencbuf} -body {
set r [zipfs info ${ziproot}def/cp850.enc]
lrange $r 0 2
@@ -221,7 +221,7 @@ S
00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0
} ;# FIXME: result depends on content of encodings dir
test zipfs-2.11 {zipfs exists} -constraints {zipfs zipfsencbuf} -body {
- zipfs exists /def/cp850.enc
+ zipfs exists ${ziproot}def/cp850.enc
} -result 1
test zipfs-2.12 {zipfs unmount while busy} -constraints {zipfs zipfsencbuf} -body {
zipfs unmount /def