|
|
@ -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) |
|
|
|