update the function for checking the sd card path

This commit is contained in:
tibbi 2017-04-15 11:23:57 +02:00
parent 2e2302c2a3
commit 98a022bbb3
2 changed files with 4 additions and 2 deletions

View file

@ -29,5 +29,5 @@ ext {
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '2.16.4'
propVersionName = '2.16.5'
}

View file

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