cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [02/40] git commit: CB-5959: Android: Ensure that directories return size 0
Date Fri, 28 Feb 2014 21:35:39 GMT
CB-5959: Android: Ensure that directories return size 0


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/2f371d0e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/2f371d0e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/2f371d0e

Branch: refs/heads/master
Commit: 2f371d0ebb5006567450040f7e2bc3417671b828
Parents: 9ac8e47
Author: Ian Clelland <iclelland@chromium.org>
Authored: Fri Feb 7 10:58:02 2014 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Fri Feb 7 10:58:02 2014 -0500

----------------------------------------------------------------------
 src/android/LocalFilesystem.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2f371d0e/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index 762f80b..329eac7 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -262,7 +262,8 @@ public class LocalFilesystem extends Filesystem {
 
         JSONObject metadata = new JSONObject();
         try {
-        	metadata.put("size", file.length());
+            // Ensure that directories report a size of 0
+        	metadata.put("size", file.isDirectory() ? 0 : file.length());
         	metadata.put("type", FileHelper.getMimeType(file.getAbsolutePath(), cordova));
         	metadata.put("name", file.getName());
         	metadata.put("fullPath", inputURL.fullPath);


Mime
View raw message