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 2014/02/11 00:22:47 UTC
[21/50] git commit: Android: Allow absolute paths on Entry.getFile /
Entry.getDirectory
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/master
Commit: fc2fc56e2241ebda6d1f985fb09ec956511d3248
Parents: d8b728a
Author: Ian Clelland <ic...@chromium.org>
Authored: Sat Jan 11 09:46:46 2014 -0500
Committer: Ian Clelland <ic...@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));