cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [4/5] git commit: Android fixes
Date Wed, 19 Feb 2014 17:36:27 GMT
Android fixes


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/00d30763
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/00d30763
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/00d30763

Branch: refs/heads/file-extras-rewrite
Commit: 00d30763323e9173f365bed6abce63a9905c7637
Parents: 0947a66
Author: Ian Clelland <iclelland@chromium.org>
Authored: Wed Feb 19 11:53:04 2014 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Wed Feb 19 12:34:52 2014 -0500

----------------------------------------------------------------------
 file-system-roots/android/FileSystemRoots.java | 16 ++++++++++------
 file-system-roots/plugin.xml                   |  6 +++---
 2 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/00d30763/file-system-roots/android/FileSystemRoots.java
----------------------------------------------------------------------
diff --git a/file-system-roots/android/FileSystemRoots.java b/file-system-roots/android/FileSystemRoots.java
index 651e3e8..10534ec 100644
--- a/file-system-roots/android/FileSystemRoots.java
+++ b/file-system-roots/android/FileSystemRoots.java
@@ -17,7 +17,7 @@
  * under the License.
  *
 */
-package org.apache.cordova.file_system_roots;
+package org.apache.cordova.filesystemroots;
 
 import android.app.Activity;
 import android.content.Context;
@@ -75,20 +75,24 @@ public class FileSystemRoots extends CordovaPlugin {
         FileUtils filePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
         if (filePlugin != null) {
             /* Register filesystems in order */
-            for (String fsName: filesystems) {
+            for (String fsName : filesystems) {
                 if (!installedFilesystems.contains(fsName)) {
                     String fsRoot = availableFilesystems.get(fsName);
                     if (fsRoot != null) {
-                        new File(fsRoot).mkdirs();
-                        filePlugin.registerFilesystem(new LocalFilesystem(fsName, cordova,
fsRoot));
-                        installedFilesystems.add(fsName);
+                        File newRoot = new File(fsRoot);
+                        if (newRoot.mkdirs() || newRoot.isDirectory()) {
+                            filePlugin.registerFilesystem(new LocalFilesystem(fsName, cordova,
fsRoot));
+                            installedFilesystems.add(fsName);
+                        } else {
+                           Log.d(TAG, "Unable to create root dir for fileystem \"" + fsName
+ "\", skipping");
+                        }
                     } else {
                         Log.d(TAG, "Unrecognized extra filesystem identifier: " + fsName);
                     }
                 }
             }
         } else {
-            Log.d(TAG, "File plugin not found; cannot initialize file-extras plugin");
+            Log.w(TAG, "File plugin not found; cannot initialize file-extras plugin");
         }
 
     }

http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/00d30763/file-system-roots/plugin.xml
----------------------------------------------------------------------
diff --git a/file-system-roots/plugin.xml b/file-system-roots/plugin.xml
index 43721a1..3eca4ab 100644
--- a/file-system-roots/plugin.xml
+++ b/file-system-roots/plugin.xml
@@ -32,11 +32,11 @@
   </js-module>
 
   <platform name="android">
-    <source-file src="android/FileSystemRoots.java" target-dir="src/org/apache/cordova/file-system-roots"
/>
+    <source-file src="android/FileSystemRoots.java" target-dir="src/org/apache/cordova/filesystemroots"
/>
 
     <config-file target="res/xml/config.xml" parent="/*">
-      <feature name="FileExtras">
-        <param name="android-package" value="org.apache.cordova.file-system-roots.FileSystemRoots"/>
+      <feature name="FileSystemRoots">
+        <param name="android-package" value="org.apache.cordova.filesystemroots.FileSystemRoots"/>
         <param name="onload" value="true"/>
       </feature>
     </config-file>


Mime
View raw message