create a directory at decompressing, if needed

This commit is contained in:
tibbi 2020-05-28 12:18:37 +02:00
parent a14919d6d9
commit 09345dba49

View file

@ -100,7 +100,18 @@ class DecompressActivity : SimpleActivity() {
while (true) {
val entry = zipInputStream.nextEntry ?: break
val filename = title.toString().substringBeforeLast(".")
val newPath = "$destination/$filename/${entry.name.trimEnd('/')}"
val parent = "$destination/$filename"
val newPath = "$parent/${entry.name.trimEnd('/')}"
if (!getDoesFilePathExist(parent)) {
if (!createDirectorySync(parent)) {
continue
}
}
if (entry.isDirectory) {
continue
}
val fos = getFileOutputStreamSync(newPath, newPath.getMimeType())
var count: Int