When I create the same ZIP with TotalCommander on Windows or with ASTRO on Android, everything works fine.
Here's the code I use in JavaIDEdroid to extract the ZIP:
Code: Select all
public String createStructureFromTemplate (String prjdir)
{
int n;
boolean ok;
File d, newFile;
byte[] buf = new byte[1024];
ZipInputStream zipinputstream = null;
FileOutputStream fileoutputstream;
ZipEntry zipentry;
String filename = G.stWorkDir+"project-template.zip";
String errmsg="";
try
{
d = new File(prjdir);
if (d.exists()) return "target dir already exists";
ok = d.mkdirs();
if (!ok) return "error creating target dir";
zipinputstream = new ZipInputStream(new FileInputStream(filename));
zipentry = zipinputstream.getNextEntry();
while (zipentry != null)
{
//for each entry to be extracted
String entryName = zipentry.getName();
newFile = new File(prjdir+entryName);
if (zipentry.isDirectory())
{
newFile.mkdirs();
}
else
{
d = newFile.getParentFile();
if (!d.isDirectory()) d.mkdirs();
fileoutputstream = new FileOutputStream(newFile);
while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
{
fileoutputstream.write(buf, 0, n);
}//while
fileoutputstream.close();
zipinputstream.closeEntry();
}//if
zipentry = zipinputstream.getNextEntry();
}//while
zipinputstream.close();
}//try
catch (Throwable t)
{
errmsg=t.getMessage();
}
return errmsg;
}
Tom