Check parent folders too when displaying unhide warning
This commit is contained in:
parent
b9f762e1e4
commit
669a0b5a96
2 changed files with 16 additions and 1 deletions
|
@ -305,7 +305,7 @@ class DirectoryAdapter(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (selectedPaths.any { File(it).isHidden }) {
|
||||
if (selectedPaths.any { it.isThisOrParentFolderHidden() }) {
|
||||
ConfirmationDialog(activity, "", R.string.cant_unhide_folder, R.string.ok, 0) {}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -91,3 +91,18 @@ fun String.getDistinctPath(): String {
|
|||
}
|
||||
|
||||
fun String.isDownloadsFolder() = equals(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString(), true)
|
||||
|
||||
fun String.isThisOrParentFolderHidden(): Boolean {
|
||||
var curFile = File(this)
|
||||
while (true) {
|
||||
if (curFile.isHidden) {
|
||||
return true
|
||||
}
|
||||
|
||||
curFile = curFile.parentFile ?: break
|
||||
if (curFile.absolutePath == "/") {
|
||||
break
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue