aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org')
-rw-r--r--app/src/main/java/org/pacien/tincapp/utils/Files.kt5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/utils/Files.kt b/app/src/main/java/org/pacien/tincapp/utils/Files.kt
index 8eda328..0228785 100644
--- a/app/src/main/java/org/pacien/tincapp/utils/Files.kt
+++ b/app/src/main/java/org/pacien/tincapp/utils/Files.kt
@@ -47,15 +47,16 @@ fun File.makePublic() {
47} 47}
48 48
49fun File.isParentOf(childCandidate: File, strict: Boolean = true): Boolean { 49fun File.isParentOf(childCandidate: File, strict: Boolean = true): Boolean {
50 var parentOfChild = childCandidate.canonicalFile 50 var parentOfChild: File? = childCandidate.canonicalFile
51 51
52 if (strict) 52 if (strict)
53 parentOfChild = parentOfChild.parentFile 53 parentOfChild = parentOfChild?.parentFile
54 54
55 while (parentOfChild != null) { 55 while (parentOfChild != null) {
56 if (parentOfChild.equals(canonicalFile)) return true 56 if (parentOfChild.equals(canonicalFile)) return true
57 parentOfChild = parentOfChild.parentFile 57 parentOfChild = parentOfChild.parentFile
58 } 58 }
59
59 return false 60 return false
60} 61}
61 62