MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getPath

Method getPath

src/plugins/sdcard/src/android/SDcard.java:1074–1093  ·  view source on GitHub ↗
(String uriString, String src, CallbackContext callback)

Source from the content-addressed store, hash-verified

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>();

Callers 1

executeMethod · 0.95

Calls 6

getUriMethod · 0.80
successMethod · 0.80
getPathMethod · 0.65
errorMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected