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 2015/03/31 19:58:15 UTC

[06/11] cordova-plugin-file git commit: android: Move URLforFullPath into base class (and rename to localUrlforFullPath)

android: Move URLforFullPath into base class (and rename to localUrlforFullPath)

Was identical in subclasses


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

Branch: refs/heads/old-ID
Commit: 2ce5c498f0a6caf64092ba001842cd0161ebefcb
Parents: a47709e
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 20:56:58 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 20:56:58 2015 -0400

----------------------------------------------------------------------
 src/android/AssetFilesystem.java | 15 +++------------
 src/android/Filesystem.java      |  8 ++++++++
 src/android/LocalFilesystem.java | 14 +++-----------
 3 files changed, 14 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2ce5c498/src/android/AssetFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/AssetFilesystem.java b/src/android/AssetFilesystem.java
index 525d188..934a237 100644
--- a/src/android/AssetFilesystem.java
+++ b/src/android/AssetFilesystem.java
@@ -132,15 +132,6 @@ public class AssetFilesystem extends Filesystem {
         }
     }
 
-    private LocalFilesystemURL URLforFullPath(String fullPath) {
-        Uri nativeUri = nativeUriForFullPath(fullPath);
-        if (nativeUri != null) {
-            return toLocalUri(nativeUri);
-        }
-        return null;
-    }
-
-
     @Override
     public LocalFilesystemURL[] listChildren(LocalFilesystemURL inputURL) throws FileNotFoundException {
         String pathNoSlashes = inputURL.path.substring(1);
@@ -157,7 +148,7 @@ public class AssetFilesystem extends Filesystem {
 
         LocalFilesystemURL[] entries = new LocalFilesystemURL[files.length];
         for (int i = 0; i < files.length; ++i) {
-            entries[i] = URLforFullPath(new File(inputURL.path, files[i]).getPath());
+            entries[i] = localUrlforFullPath(new File(inputURL.path, files[i]).getPath());
         }
         return entries;
 	}
@@ -177,9 +168,9 @@ public class AssetFilesystem extends Filesystem {
 
         LocalFilesystemURL requestedURL;
         if (path.startsWith("/")) {
-            requestedURL = URLforFullPath(normalizePath(path));
+            requestedURL = localUrlforFullPath(normalizePath(path));
         } else {
-            requestedURL = URLforFullPath(normalizePath(inputURL.path + "/" + path));
+            requestedURL = localUrlforFullPath(normalizePath(inputURL.path + "/" + path));
         }
 
         // Throws a FileNotFoundException if it doesn't exist.

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2ce5c498/src/android/Filesystem.java
----------------------------------------------------------------------
diff --git a/src/android/Filesystem.java b/src/android/Filesystem.java
index 478f6f0..faf31d2 100644
--- a/src/android/Filesystem.java
+++ b/src/android/Filesystem.java
@@ -146,6 +146,14 @@ public abstract class Filesystem {
         return ret;
     }
 
+    public LocalFilesystemURL localUrlforFullPath(String fullPath) {
+        Uri nativeUri = nativeUriForFullPath(fullPath);
+        if (nativeUri != null) {
+            return toLocalUri(nativeUri);
+        }
+        return null;
+    }
+
     /**
      * Removes multiple repeated //s, and collapses processes ../s.
      */

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2ce5c498/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index 355cccf..258b957 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -60,14 +60,6 @@ public class LocalFilesystem extends Filesystem {
 		return null;
 	}
 
-	protected LocalFilesystemURL URLforFullPath(String fullPath) {
-        Uri nativeUri = nativeUriForFullPath(fullPath);
-	    if (nativeUri != null) {
-            return toLocalUri(nativeUri);
-	    }
-	    return null;
-	}
-
     @Override
     public Uri toNativeUri(LocalFilesystemURL inputURL) {
         return nativeUriForFullPath(inputURL.path);
@@ -107,7 +99,7 @@ public class LocalFilesystem extends Filesystem {
 	
 	@Override
 	public LocalFilesystemURL URLforFilesystemPath(String path) {
-	    return this.URLforFullPath(this.fullPathForFilesystemPath(path));
+	    return localUrlforFullPath(fullPathForFilesystemPath(path));
 	}
 
 	@Override
@@ -135,9 +127,9 @@ public class LocalFilesystem extends Filesystem {
             path += "/";
         }
         if (path.startsWith("/")) {
-        	requestedURL = URLforFullPath(normalizePath(path));
+        	requestedURL = localUrlforFullPath(normalizePath(path));
         } else {
-        	requestedURL = URLforFullPath(normalizePath(inputURL.path + "/" + path));
+        	requestedURL = localUrlforFullPath(normalizePath(inputURL.path + "/" + path));
         }
         
         File fp = new File(this.filesystemPathForURL(requestedURL));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org