Skip to content

Commit

Permalink
check if global root is a directory. For cases where the root directo…
Browse files Browse the repository at this point in the history
…ry is deleted and replaced with file of the same name.
  • Loading branch information
sayantan-kgp committed Mar 14, 2021
1 parent d93519d commit 6d72327
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/balti/filex/FileXInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FileXInit(context: Context, isTraditional: Boolean) {
val storageVolumes = HashMap<String, String?>(0)

fun isUserPermissionGranted(): Boolean{
return if (!globalIsTraditional) RootUri.getGlobalRootUri().let { it != null && Tools.checkUriExists(it) }
return if (!globalIsTraditional) RootUri.getGlobalRootUri().let { it != null && Tools.checkUriExists(it, true) }
else {
ContextCompat.checkSelfPermission(fContext, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(fContext, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
Expand All @@ -52,7 +52,7 @@ class FileXInit(context: Context, isTraditional: Boolean) {
fun requestUserPermission(reRequest: Boolean = false, onResult: ((resultCode: Int, data: Intent?) -> Unit)? = null) {
if (!globalIsTraditional) {
val globalRoot = RootUri.getGlobalRootUri()
if (globalRoot == null || !Tools.checkUriExists(globalRoot) || reRequest) {
if (globalRoot == null || !Tools.checkUriExists(globalRoot, true) || reRequest) {
RootUri.resetGlobalRootUri() { resultCode, data ->
onResult?.invoke(resultCode, data)
}
Expand Down

0 comments on commit 6d72327

Please sign in to comment.