Converts the specified URI to a file path. @param uri URI to be converted @return file path
(final String uri)
| 96 | * @return file path |
| 97 | */ |
| 98 | static String toPath(final String uri) { |
| 99 | try { |
| 100 | return new URL(uri).toURI().getPath(); |
| 101 | } catch(final Exception ex) { |
| 102 | Util.debug(ex); |
| 103 | // workaround for URIs with invalid characters |
| 104 | return uri.replaceAll("^" + FILEPREF + '*', "/").replaceFirst("^/([A-Za-z]:)", "$1"); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Returns the file reference. |