You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/02/11 00:23:13 UTC
[47/50] git commit: CB-5974: Android: Don't allow File operations to
continue when not configured
CB-5974: Android: Don't allow File operations to continue when not configured
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/f4ed88d8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/f4ed88d8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/f4ed88d8
Branch: refs/heads/master
Commit: f4ed88d8da9944fbd7863bf03b276dd03c98daad
Parents: 4ce92df
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Feb 5 00:03:03 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Feb 5 00:03:03 2014 -0500
----------------------------------------------------------------------
src/android/FileUtils.java | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f4ed88d8/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index cc5e8c0..26e3479 100644
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -66,6 +66,8 @@ public class FileUtils extends CordovaPlugin {
public static int UNKNOWN_ERR = 1000;
+ private boolean configured = false;
+
// This field exists only to support getEntry, below, which has been deprecated
private static FileUtils filePlugin;
@@ -139,6 +141,8 @@ public class FileUtils extends CordovaPlugin {
this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot));
this.registerFilesystem(new ContentFilesystem("content", cordova, webView));
+ this.configured = true;
+
// Initialize static plugin reference for deprecated getEntry method
if (filePlugin == null) {
FileUtils.filePlugin = this;
@@ -182,6 +186,10 @@ public class FileUtils extends CordovaPlugin {
* @return True if the action was valid, false otherwise.
*/
public boolean execute(String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException {
+ if (!configured) {
+ callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "File plugin is not configured. Please see the README.md file for details on how to update config.xml"));
+ return true;
+ }
if (action.equals("testSaveLocationExists")) {
threadhelper( new FileOp( ){
public void run() {