kunfei 3 år sedan
förälder
incheckning
2b4b163773

+ 2 - 2
app/src/main/java/io/legado/app/utils/ArchiveUtils.kt

@@ -2,11 +2,11 @@ package io.legado.app.utils
 
 
 import android.net.Uri
 import android.net.Uri
 import androidx.documentfile.provider.DocumentFile
 import androidx.documentfile.provider.DocumentFile
-import java.io.File
-
 import splitties.init.appCtx
 import splitties.init.appCtx
+import java.io.File
 
 
 /* 自动判断压缩文件后缀 然后再调用具体的实现 */
 /* 自动判断压缩文件后缀 然后再调用具体的实现 */
+@Suppress("unused", "MemberVisibilityCanBePrivate")
 object ArchiveUtils {
 object ArchiveUtils {
 
 
     // 临时目录 下次启动自动删除
     // 临时目录 下次启动自动删除

+ 3 - 4
app/src/main/java/io/legado/app/utils/RarUtils.kt

@@ -49,10 +49,10 @@ object RarUtils {
     }
     }
 
 
     fun unRarToPath(archive: Archive, destDir: File?) {
     fun unRarToPath(archive: Archive, destDir: File?) {
-        var entry: FileHeader
+        var entry: FileHeader?
         while (archive.nextFileHeader().also { entry = it } != null) {
         while (archive.nextFileHeader().also { entry = it } != null) {
-            val entryFile = File(destDir, entry.fileName)
-            if (entry.isDirectory) {
+            val entryFile = File(destDir, entry!!.fileName)
+            if (entry!!.isDirectory) {
                 if (!entryFile.exists()) {
                 if (!entryFile.exists()) {
                     entryFile.mkdirs()
                     entryFile.mkdirs()
                 }
                 }
@@ -69,7 +69,6 @@ object RarUtils {
             FileOutputStream(entryFile).use {
             FileOutputStream(entryFile).use {
                 archive.getInputStream(entry).copyTo(it)
                 archive.getInputStream(entry).copyTo(it)
             }
             }
-
         }
         }
     }
     }
 
 

+ 4 - 4
app/src/main/java/io/legado/app/utils/SevenZipUtils.kt

@@ -50,10 +50,10 @@ object SevenZipUtils {
 
 
 
 
     fun un7zToPath(sevenZFile:SevenZFile, destDir: File?){
     fun un7zToPath(sevenZFile:SevenZFile, destDir: File?){
-        var entry: SevenZArchiveEntry
-        while (sevenZFile.nextEntry.also { entry=it }!=null){
-            val entryFile = File(destDir, entry.name)
-            if (entry.isDirectory) {
+        var entry: SevenZArchiveEntry?
+        while (sevenZFile.nextEntry.also { entry=it }!=null) {
+            val entryFile = File(destDir, entry!!.name)
+            if (entry!!.isDirectory) {
                 if (!entryFile.exists()) {
                 if (!entryFile.exists()) {
                     entryFile.mkdirs()
                     entryFile.mkdirs()
                 }
                 }

+ 3 - 3
app/src/main/java/io/legado/app/utils/ZipUtils.kt

@@ -180,10 +180,10 @@ object ZipUtils {
     }
     }
 
 
     fun unZipToPath(zipInputStream: ZipInputStream, path: String) {
     fun unZipToPath(zipInputStream: ZipInputStream, path: String) {
-        var entry: ZipEntry
+        var entry: ZipEntry?
         while (zipInputStream.nextEntry.also { entry = it } != null) {
         while (zipInputStream.nextEntry.also { entry = it } != null) {
-            val entryFile = File(path, entry.name)
-            if (entry.isDirectory) {
+            val entryFile = File(path, entry!!.name)
+            if (entry!!.isDirectory) {
                 if (!entryFile.exists()) {
                 if (!entryFile.exists()) {
                     entryFile.mkdirs()
                     entryFile.mkdirs()
                 }
                 }