ZipArchive.st
changeset 2752 051b5bef3be7
parent 2677 23f154688173
child 2832 4e995f270bde
--- a/ZipArchive.st	Thu Jul 19 19:36:36 2012 +0200
+++ b/ZipArchive.st	Fri Jul 20 20:38:41 2012 +0200
@@ -3612,6 +3612,32 @@
     "Modified: / 18-11-2010 / 20:23:35 / cg"
 !
 
+findMemberAllowForMissingTrailingSlash: name
+    "find a zipMember by name. Allow for missing trailing slash for directories.
+     This method is currently used by JavaVM"
+    | nameWithSlash |
+
+    nameWithSlash := name , '/'.
+
+    self zipMembersDo:[:each |
+        | fn |
+
+        fn := each fileName.
+        (fn = name) ifTrue:[^ each].
+        "Try if they differ only in trailing slash"
+        ((fn size) = (name size + 1) 
+            and:[fn = nameWithSlash]) ifTrue:[ 
+                "/Here, return a copy with patched name:
+                ^each copy
+                    fileName: name;
+                    yourself.
+            ]
+    ].
+    ^ nil
+
+    "Created: / 20-07-2012 / 19:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 findMemberForWhich:aBlock
     "find a zipMember by condition"
 
@@ -5039,11 +5065,11 @@
 !ZipArchive class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.95 2011-11-25 17:00:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.96 2012-07-20 18:38:41 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.95 2011-11-25 17:00:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.96 2012-07-20 18:38:41 vrany Exp $'
 ! !
 
 ZipArchive initialize!