From 3875f046fc4d6af839a982c058204bb4d8f65238 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 18 Sep 2019 08:43:29 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/help/storage/Restore.kt | 2 +- app/src/main/java/io/legado/app/utils/FileUtils.kt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/Restore.kt b/app/src/main/java/io/legado/app/help/storage/Restore.kt index 52ead5de6..ad0db5710 100644 --- a/app/src/main/java/io/legado/app/help/storage/Restore.kt +++ b/app/src/main/java/io/legado/app/help/storage/Restore.kt @@ -82,7 +82,7 @@ object Restore { } fun importYueDuData(context: Context) { - val file = File(FileUtils.getSdPath(), "YueDu") + val file = File(FileUtils.getSdCardPath(), "YueDu") // 导入书架 val shelfFile = File(file, "myBookShelf.json") diff --git a/app/src/main/java/io/legado/app/utils/FileUtils.kt b/app/src/main/java/io/legado/app/utils/FileUtils.kt index 861d7e88e..4626fe489 100644 --- a/app/src/main/java/io/legado/app/utils/FileUtils.kt +++ b/app/src/main/java/io/legado/app/utils/FileUtils.kt @@ -16,7 +16,6 @@ import java.util.* object FileUtils { - fun getSdPath() = Environment.getExternalStorageDirectory().absolutePath fun getFileByPath(filePath: String): File? { return if (filePath.isBlank()) null else File(filePath) @@ -41,8 +40,8 @@ object FileUtils { try { val getVolumeList = storageManager.javaClass.getMethod("getVolumeList") - val storageValumeClazz = Class.forName("android.os.storage.StorageVolume") - val getPath = storageValumeClazz.getMethod("getPath") + val storageVolumeClazz = Class.forName("android.os.storage.StorageVolume") + val getPath = storageVolumeClazz.getMethod("getPath") val invokeVolumeList = getVolumeList.invoke(storageManager) val length = Array.getLength(invokeVolumeList)