update the function for checking the sd card path
This commit is contained in:
parent
2e2302c2a3
commit
98a022bbb3
2 changed files with 4 additions and 2 deletions
|
@ -29,5 +29,5 @@ ext {
|
|||
propMinSdkVersion = 16
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '2.16.4'
|
||||
propVersionName = '2.16.5'
|
||||
}
|
||||
|
|
|
@ -25,7 +25,9 @@ fun Context.getSDCardPath(): String {
|
|||
return ""
|
||||
}
|
||||
|
||||
return getStorageDirectories().firstOrNull { it.trimEnd('/') != internalStoragePath } ?: ""
|
||||
val directories = getStorageDirectories().filter { it.trimEnd('/') != internalStoragePath }
|
||||
val sdCardPath = directories.firstOrNull { !physicalPaths.contains(it.trimEnd('/')) } ?: directories.first() ?: ""
|
||||
return sdCardPath
|
||||
}
|
||||
|
||||
fun Context.hasExternalSDCard() = sdCardPath.isNotEmpty()
|
||||
|
|
Loading…
Reference in a new issue