Merge pull request #317 from tufteddeer/iss_308

extract zip to correct path
This commit is contained in:
Tibor Kaputa 2019-05-04 18:25:06 +02:00 committed by GitHub
commit 4324c7e797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -461,10 +461,12 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
try { try {
val zipFile = ZipFile(it) val zipFile = ZipFile(it)
val entries = zipFile.entries() val entries = zipFile.entries()
val zipFileName = it.getFilenameFromPath()
val newFolderName = zipFileName.subSequence(0, zipFileName.length-4)
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
val entry = entries.nextElement() val entry = entries.nextElement()
val parentPath = it.getParentPath() val parentPath = it.getParentPath()
val newPath = "$parentPath${entry.name.trimEnd('/')}" val newPath = "$parentPath/$newFolderName/${entry.name.trimEnd('/')}"
val resolution = getConflictResolution(conflictResolutions, newPath) val resolution = getConflictResolution(conflictResolutions, newPath)
val doesPathExist = File(newPath).exists() val doesPathExist = File(newPath).exists()