Author: thomas.heute(a)jboss.com
Date: 2010-02-15 14:39:40 -0500 (Mon, 15 Feb 2010)
New Revision: 1699
Modified:
maven/packager/trunk/src/main/javascript/eXo/core/IOUtil.js
Log:
GTNMAVEN-1: Ability to unzip a package
Fix: first treat directories, then files
Modified: maven/packager/trunk/src/main/javascript/eXo/core/IOUtil.js
===================================================================
--- maven/packager/trunk/src/main/javascript/eXo/core/IOUtil.js 2010-02-15 18:11:46 UTC
(rev 1698)
+++ maven/packager/trunk/src/main/javascript/eXo/core/IOUtil.js 2010-02-15 19:39:40 UTC
(rev 1699)
@@ -284,25 +284,33 @@
var entries = zipFile.entries();
+ // First treat directories
while(entries.hasMoreElements()) {
var entry = entries.nextElement();
if(entry.isDirectory()) {
- new java.io.File(dest + "/" + entry.getName()).mkdir();
+ new java.io.File(dest + "/" + entry.getName()).mkdirs();
continue;
}
-
- var input = zipFile.getInputStream(entry);
- var output = new java.io.FileOutputStream(dest + "/" +
entry.getName());
- var buffer = this.createByteArray(12) ;
- var len;
+ }
+
+ // Then files
+ entries = zipFile.entries();
+ while(entries.hasMoreElements()) {
+ var entry = entries.nextElement();
+ if (!entry.isDirectory())
+ {
+ var input = zipFile.getInputStream(entry);
+ var output = new java.io.FileOutputStream(dest + "/" +
entry.getName());
+ var buffer = this.createByteArray(12) ;
+ var len;
- while((len = input.read(buffer)) >= 0)
- output.write(buffer, 0, len);
+ while((len = input.read(buffer)) >= 0)
+ output.write(buffer, 0, len);
- input.close();
- output.close();
-
+ input.close();
+ output.close();
+ }
}
zipFile.close();
Show replies by date