| 1072 | } |
| 1073 | |
| 1074 | private void getPath(String uriString, String src, CallbackContext callback) { |
| 1075 | try { |
| 1076 | DocumentFile file = geRelativeDocumentFile(uriString, src); |
| 1077 | |
| 1078 | if (file == null) { |
| 1079 | callback.error("Unable to get file"); |
| 1080 | } else { |
| 1081 | Uri uri = file.getUri(); |
| 1082 | String path = uri.getPath(); |
| 1083 | |
| 1084 | if (path != null) { |
| 1085 | callback.success(uri.toString()); |
| 1086 | } else { |
| 1087 | callback.error("Unable to get path"); |
| 1088 | } |
| 1089 | } |
| 1090 | } catch (Exception e) { |
| 1091 | callback.error(e.getMessage()); |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | private DocumentFile geRelativeDocumentFile(String uri, String filename) { |
| 1096 | List<String> paths = new ArrayList<String>(); |