Check if this local URI is within the XCSoarData directory, and returns the absolute path. Returns null on mismatch.
(Uri uri)
| 84 | * returns the absolute path. Returns null on mismatch. |
| 85 | */ |
| 86 | String matchPath(Uri uri) { |
| 87 | /* XXX this check is a kludge to identify downloads started |
| 88 | by XCSoar */ |
| 89 | |
| 90 | if (!uri.getScheme().equals("file")) |
| 91 | return null; |
| 92 | |
| 93 | final String path = uri.getPath(); |
| 94 | final File file = new File(path); |
| 95 | final File parent = file.getParentFile(); |
| 96 | if (parent == null || !parent.equals(downloadDirectory)) |
| 97 | /* not in the download directory - not for us */ |
| 98 | return null; |
| 99 | |
| 100 | return path; |
| 101 | } |
| 102 | |
| 103 | String matchPath(String uri) { |
| 104 | return uri != null |
no test coverage detected