cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [3/6] git commit: Android: Allow absolute paths on Entry.getFile / Entry.getDirectory
Date Mon, 13 Jan 2014 15:11:35 GMT
Android: Allow absolute paths on Entry.getFile / Entry.getDirectory


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

Branch: refs/heads/dev
Commit: fc2fc56e2241ebda6d1f985fb09ec956511d3248
Parents: d8b728a
Author: Ian Clelland <iclelland@chromium.org>
Authored: Sat Jan 11 09:46:46 2014 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Sat Jan 11 09:46:46 2014 -0500

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


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/fc2fc56e/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index c16aefe..b64118b 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -107,7 +107,14 @@ public class LocalFilesystem extends Filesystem {
             throw new EncodingException("This path has an invalid \":\" in it.");
         }
 
-        LocalFilesystemURL requestedURL = new LocalFilesystemURL(Uri.withAppendedPath(inputURL.URL,
fileName));
+        LocalFilesystemURL requestedURL;
+        
+        // Check whether the supplied path is absolute or relative
+        if (path.startsWith("/")) {
+        	requestedURL = URLforFilesystemPath(path);
+        } else {
+        	requestedURL = new LocalFilesystemURL(Uri.withAppendedPath(inputURL.URL, path));
+        }
         
         File fp = new File(this.filesystemPathForURL(requestedURL));
 


Mime
View raw message