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)