mirror of
https://gitee.com/shuto/cordova-plugin-file-opener2.git
synced 2025-01-31 12:02:49 +08:00
- Andorid: Support for both relative and absolute path
- Upped the version to 1.0.8
This commit is contained in:
parent
383d2bf514
commit
ef5c633f47
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" id="io.github.pwlin.cordova.plugins.fileopener2"
|
||||
version="1.0.7">
|
||||
version="1.0.8">
|
||||
|
||||
<name>File Opener2</name>
|
||||
<description>A File Opener Plugin for Cordova.</description>
|
||||
|
@ -74,12 +74,15 @@ public class FileOpener2 extends CordovaPlugin {
|
||||
}
|
||||
|
||||
private boolean _open(String fileArg, String contentType, CallbackContext callbackContext) throws JSONException {
|
||||
|
||||
CordovaResourceApi resourceApi = webView.getResourceApi();
|
||||
|
||||
Uri fileUri = resourceApi.remapUri(Uri.parse(fileArg));
|
||||
String fileName = org.apache.cordova.FileHelper.stripFileProtocol(fileUri.toString());
|
||||
|
||||
String fileName = "";
|
||||
try {
|
||||
CordovaResourceApi resourceApi = webView.getResourceApi();
|
||||
Uri fileUri = resourceApi.remapUri(Uri.parse(fileArg));
|
||||
fileName = org.apache.cordova.FileHelper.stripFileProtocol(fileUri.toString());
|
||||
} catch (Exception e) {
|
||||
fileName = fileArg;
|
||||
}
|
||||
|
||||
File file = new File(fileName);
|
||||
|
||||
if (file.exists()) {
|
||||
|
Loading…
Reference in New Issue
Block a user