mirror of
https://gitee.com/shuto/cordova-plugin-file-opener2.git
synced 2025-01-31 12:02:49 +08:00
Support relative paths on 3.3 Cordova in Android
This commit is contained in:
parent
9b0770f0d8
commit
83855311fe
@ -11,6 +11,7 @@ import android.net.Uri;
|
|||||||
import org.apache.cordova.CordovaPlugin;
|
import org.apache.cordova.CordovaPlugin;
|
||||||
import org.apache.cordova.CallbackContext;
|
import org.apache.cordova.CallbackContext;
|
||||||
import org.apache.cordova.PluginResult;
|
import org.apache.cordova.PluginResult;
|
||||||
|
import org.apache.cordova.CordovaResourceApi;
|
||||||
|
|
||||||
public class FileOpener2 extends CordovaPlugin {
|
public class FileOpener2 extends CordovaPlugin {
|
||||||
|
|
||||||
@ -72,7 +73,12 @@ public class FileOpener2 extends CordovaPlugin {
|
|||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean _open(String fileName, String contentType, CallbackContext callbackContext) throws JSONException {
|
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());
|
||||||
|
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user