small tweak to file document obtaining
This commit is contained in:
parent
cf6b707250
commit
dcb2575ee9
1 changed files with 4 additions and 1 deletions
|
@ -95,7 +95,10 @@ fun Context.isAStorageRootFolder(path: String): Boolean {
|
|||
}
|
||||
|
||||
fun Context.getFileDocument(path: String, treeUri: String): DocumentFile {
|
||||
val relativePath = path.substring(getSDCardPath().length + 1)
|
||||
var relativePath = path.substring(getSDCardPath().length)
|
||||
if (relativePath.startsWith(File.separator))
|
||||
relativePath = relativePath.substring(1)
|
||||
|
||||
var document = DocumentFile.fromTreeUri(this, Uri.parse(treeUri))
|
||||
val parts = relativePath.split("/")
|
||||
for (part in parts) {
|
||||
|
|
Loading…
Reference in a new issue