- fixed that unzip will name the files correctly even if in the zip
the filename is other one
This commit is contained in:
parent
a68d4b1ce3
commit
3fd934753a
1 changed files with 16 additions and 10 deletions
|
@ -680,21 +680,27 @@ public class DownloadIndexActivity extends ListActivity {
|
|||
}
|
||||
ZipInputStream zipIn = new ZipInputStream(new FileInputStream(fileToDownload));
|
||||
ZipEntry entry = null;
|
||||
boolean first = true;
|
||||
while ((entry = zipIn.getNextEntry()) != null) {
|
||||
File fs;
|
||||
if (!unzipToDir) {
|
||||
String name = entry.getName();
|
||||
// small simplification
|
||||
int ind = name.lastIndexOf('_');
|
||||
if (ind > 0) {
|
||||
// cut version
|
||||
int i = name.indexOf('.', ind);
|
||||
if (i > 0) {
|
||||
name = name.substring(0, ind) + name.substring(i, name.length());
|
||||
if (first) {
|
||||
fs = toIndex;
|
||||
first = false;
|
||||
} else {
|
||||
String name = entry.getName();
|
||||
// small simplification
|
||||
int ind = name.lastIndexOf('_');
|
||||
if (ind > 0) {
|
||||
// cut version
|
||||
int i = name.indexOf('.', ind);
|
||||
if (i > 0) {
|
||||
name = name.substring(0, ind) + name.substring(i, name.length());
|
||||
}
|
||||
}
|
||||
fs = new File(fileToUnZip.getParent(), name);
|
||||
toIndex = fs;
|
||||
}
|
||||
fs = new File(fileToUnZip.getParent(), name);
|
||||
|
||||
} else {
|
||||
fs = new File(fileToUnZip, entry.getName());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue