Merge pull request #5 from sullivanpt/master

Support relative paths on 3.3 Cordova in Android
This commit is contained in:
pwlin 2014-05-18 21:34:27 +02:00
commit 1642cd59fd

View File

@ -11,6 +11,7 @@ import android.net.Uri;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.PluginResult;
import org.apache.cordova.CordovaResourceApi;
public class FileOpener2 extends CordovaPlugin {
@ -72,7 +73,12 @@ public class FileOpener2 extends CordovaPlugin {
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);