Skip to content

Commit 09345db

Browse files
committed
create a directory at decompressing, if needed
1 parent a14919d commit 09345db

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,18 @@ class DecompressActivity : SimpleActivity() {
100100
while (true) {
101101
val entry = zipInputStream.nextEntry ?: break
102102
val filename = title.toString().substringBeforeLast(".")
103-
val newPath = "$destination/$filename/${entry.name.trimEnd('/')}"
103+
val parent = "$destination/$filename"
104+
val newPath = "$parent/${entry.name.trimEnd('/')}"
105+
106+
if (!getDoesFilePathExist(parent)) {
107+
if (!createDirectorySync(parent)) {
108+
continue
109+
}
110+
}
111+
112+
if (entry.isDirectory) {
113+
continue
114+
}
104115

105116
val fos = getFileOutputStreamSync(newPath, newPath.getMimeType())
106117
var count: Int

0 commit comments

Comments
 (0)