cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject git commit: CB-5974: Android: Don't allow File operations to continue when not configured
Date Wed, 05 Feb 2014 05:03:49 GMT
Updated Branches:
  refs/heads/dev 4ce92dff1 -> f4ed88d8d


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/dev
Commit: f4ed88d8da9944fbd7863bf03b276dd03c98daad
Parents: 4ce92df
Author: Ian Clelland <iclelland@chromium.org>
Authored: Wed Feb 5 00:03:03 2014 -0500
Committer: Ian Clelland <iclelland@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() {


Mime
View raw message