|
|
|
|
@ -10,12 +10,11 @@ import android.provider.OpenableColumns
|
|
|
|
|
import androidx.core.database.getStringOrNull
|
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
|
import kotlinx.coroutines.runInterruptible
|
|
|
|
|
import okhttp3.internal.closeQuietly
|
|
|
|
|
import org.jetbrains.annotations.Blocking
|
|
|
|
|
import org.koitharu.kotatsu.R
|
|
|
|
|
import org.koitharu.kotatsu.core.fs.FileSequence
|
|
|
|
|
import java.io.BufferedReader
|
|
|
|
|
import java.io.File
|
|
|
|
|
import java.io.InputStream
|
|
|
|
|
import java.nio.file.attribute.BasicFileAttributes
|
|
|
|
|
import java.util.zip.ZipEntry
|
|
|
|
|
import java.util.zip.ZipFile
|
|
|
|
|
@ -35,8 +34,8 @@ fun File.takeIfWriteable() = takeIf { it.exists() && it.canWrite() }
|
|
|
|
|
fun File.isNotEmpty() = length() != 0L
|
|
|
|
|
|
|
|
|
|
@Blocking
|
|
|
|
|
fun ZipFile.readText(entry: ZipEntry) = getInputStream(entry).bufferedReader().use {
|
|
|
|
|
it.readText()
|
|
|
|
|
fun ZipFile.readText(entry: ZipEntry) = getInputStream(entry).use { output ->
|
|
|
|
|
output.bufferedReader().use(BufferedReader::readText)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun File.getStorageName(context: Context): String = runCatching {
|
|
|
|
|
|