pull/34/head
kunfei 5 years ago
parent 04944d6ae0
commit 3875f046fc
  1. 2
      app/src/main/java/io/legado/app/help/storage/Restore.kt
  2. 5
      app/src/main/java/io/legado/app/utils/FileUtils.kt

@ -82,7 +82,7 @@ object Restore {
} }
fun importYueDuData(context: Context) { fun importYueDuData(context: Context) {
val file = File(FileUtils.getSdPath(), "YueDu") val file = File(FileUtils.getSdCardPath(), "YueDu")
// 导入书架 // 导入书架
val shelfFile = File(file, "myBookShelf.json") val shelfFile = File(file, "myBookShelf.json")

@ -16,7 +16,6 @@ import java.util.*
object FileUtils { object FileUtils {
fun getSdPath() = Environment.getExternalStorageDirectory().absolutePath
fun getFileByPath(filePath: String): File? { fun getFileByPath(filePath: String): File? {
return if (filePath.isBlank()) null else File(filePath) return if (filePath.isBlank()) null else File(filePath)
@ -41,8 +40,8 @@ object FileUtils {
try { try {
val getVolumeList = storageManager.javaClass.getMethod("getVolumeList") val getVolumeList = storageManager.javaClass.getMethod("getVolumeList")
val storageValumeClazz = Class.forName("android.os.storage.StorageVolume") val storageVolumeClazz = Class.forName("android.os.storage.StorageVolume")
val getPath = storageValumeClazz.getMethod("getPath") val getPath = storageVolumeClazz.getMethod("getPath")
val invokeVolumeList = getVolumeList.invoke(storageManager) val invokeVolumeList = getVolumeList.invoke(storageManager)
val length = Array.getLength(invokeVolumeList) val length = Array.getLength(invokeVolumeList)

Loading…
Cancel
Save