korge icon indicating copy to clipboard operation
korge copied to clipboard

How to extract ZIP file?

Open belousovgm opened this issue 2 years ago • 1 comments

Hello! I trying to extract zip file but always receive a crash:

Uncaught Kotlin exception: com.soywiz.korio.lang.FileNotFoundException: Can't open '/private/var/mobile/Containers/Data/Application/B37123454-1423B-1263-234-4FHGNDOSK/tmp/folder/file.zip/file' with mode 'rb' errno=92, errstr=Illegal byte sequence

Code: tempVfs["folder"]["file.zip"].openAsZip()["file"].copyTo(tempVfs["folder"])

Could you please suggest solution for extracting whole zip? Thank you!

belousovgm avatar Aug 03 '22 10:08 belousovgm

copyTo copies a single file so it won't work for directories like that: https://github.com/korlibs/korge/blob/f448b148c5d1da60e32359df03538f1ecf118473/korio/src/commonMain/kotlin/com/soywiz/korio/file/VfsFile.kt#L77

Thought it would be a nice use-case to support copying folders recursively to for example extract zip files. Can you open a feature request in this repo?

soywiz avatar Aug 24 '22 20:08 soywiz