File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
android/src/main/kotlin/codeux/design/filepicker/file_picker_writable Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -79,15 +79,22 @@ class FilePickerWritableImpl(
7979 val intent = Intent (Intent .ACTION_OPEN_DOCUMENT_TREE ).apply {
8080 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
8181 if (initialDirUri != null ) {
82- val parsedUri = Uri .parse(initialDirUri).let {
83- val context = requireActivity().applicationContext
84- if (DocumentsContract .isDocumentUri(context, it)) {
85- it
86- } else {
87- DocumentsContract .buildDocumentUriUsingTree(it, DocumentsContract .getTreeDocumentId(it))
82+ try {
83+ val parsedUri = Uri .parse(initialDirUri).let {
84+ val context = requireActivity().applicationContext
85+ if (DocumentsContract .isDocumentUri(context, it)) {
86+ it
87+ } else {
88+ DocumentsContract .buildDocumentUriUsingTree(
89+ it,
90+ DocumentsContract .getTreeDocumentId(it)
91+ )
92+ }
8893 }
94+ putExtra(DocumentsContract .EXTRA_INITIAL_URI , parsedUri)
95+ } catch (e: Exception ) {
96+ plugin.logDebug(" exception while preparing document picker initial dir" , e)
8997 }
90- putExtra(DocumentsContract .EXTRA_INITIAL_URI , parsedUri)
9198 }
9299 }
93100 }
You can’t perform that action at this time.
0 commit comments