You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/01/13 16:11:33 UTC
[1/6] git commit: CB-5008: Rename resolveLocalFileSystemURI to
resolveLocalFileSystemURL; deprecate original
Updated Branches:
refs/heads/dev 89e6e62d3 -> 9d528160e
CB-5008: Rename resolveLocalFileSystemURI to resolveLocalFileSystemURL; deprecate original
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/9ec003a0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/9ec003a0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/9ec003a0
Branch: refs/heads/dev
Commit: 9ec003a0a5678db1a54aacf74d0db416a2833803
Parents: 89e6e62
Author: Ian Clelland <ic...@chromium.org>
Authored: Sat Jan 11 09:43:08 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Sat Jan 11 09:43:08 2014 -0500
----------------------------------------------------------------------
plugin.xml | 2 +-
www/resolveLocalFileSystemURI.js | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9ec003a0/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index e8e6ba6..f5d215a 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -79,7 +79,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
</js-module>
<js-module src="www/resolveLocalFileSystemURI.js" name="resolveLocalFileSystemURI">
- <clobbers target="window.resolveLocalFileSystemURI" />
+ <merges target="window" />
</js-module>
<!-- android -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9ec003a0/www/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/resolveLocalFileSystemURI.js b/www/resolveLocalFileSystemURI.js
index 8bfbfe2..3d3b1dc 100644
--- a/www/resolveLocalFileSystemURI.js
+++ b/www/resolveLocalFileSystemURI.js
@@ -31,7 +31,7 @@ var argscheck = require('cordova/argscheck'),
* @param successCallback invoked with Entry object corresponding to URI
* @param errorCallback invoked if error occurs retrieving file system entry
*/
-module.exports = function(uri, successCallback, errorCallback) {
+module.exports.resolveLocalFileSystemURL = function(uri, successCallback, errorCallback) {
argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
// error callback
var fail = function(error) {
@@ -63,3 +63,7 @@ module.exports = function(uri, successCallback, errorCallback) {
exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
};
+module.exports.resolveLocalFileSystemURI = function() {
+ console.log("resolveLocalfileSystemURI is deprecated. Please call reolvelLocalFileSystemURL instead");
+ module.exports.resolveLocalFileSystemURL.apply(this, arguments);
+};
[4/6] git commit: Android,
iOS: Replace "filesystem" protocol string with constant
Posted by ia...@apache.org.
Android, iOS: Replace "filesystem" protocol string with constant
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/2a225e32
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/2a225e32
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/2a225e32
Branch: refs/heads/dev
Commit: 2a225e322ea2fac7e45e5348b0aaf2127ca0a2f5
Parents: fc2fc56
Author: Ian Clelland <ic...@chromium.org>
Authored: Sat Jan 11 09:56:48 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Jan 13 10:10:24 2014 -0500
----------------------------------------------------------------------
src/android/FileUtils.java | 4 ++--
src/android/LocalFilesystem.java | 2 +-
src/android/LocalFilesystemURL.java | 5 ++++-
src/ios/CDVFile.h | 1 +
src/ios/CDVFile.m | 6 +++---
src/ios/CDVLocalFilesystem.m | 2 +-
www/android/FileSystem.js | 4 +++-
www/ios/FileSystem.js | 4 +++-
8 files changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index b04c901..0a7bf7b 100644
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -702,11 +702,11 @@ public class FileUtils extends CordovaPlugin {
LocalFilesystemURL rootURL;
if (type == TEMPORARY) {
fs.put("name", "temporary");
- rootURL = new LocalFilesystemURL("filesystem://localhost/temporary/");
+ rootURL = new LocalFilesystemURL(LocalFilesystemURL.FILESYSTEM_PROTOCOL + "://localhost/temporary/");
}
else if (type == PERSISTENT) {
fs.put("name", "persistent");
- rootURL = new LocalFilesystemURL("filesystem://localhost/persistent/");
+ rootURL = new LocalFilesystemURL(LocalFilesystemURL.FILESYSTEM_PROTOCOL+ "://localhost/persistent/");
}
else {
throw new IOException("No filesystem of type requested");
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index b64118b..171dd9d 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -51,7 +51,7 @@ public class LocalFilesystem extends Filesystem {
public LocalFilesystemURL URLforFilesystemPath(String path) {
String fullPath = this.fullPathForFilesystemPath(path);
if (fullPath != null) {
- return new LocalFilesystemURL("filesystem://localhost/"+this.name+"/"+fullPath);
+ return new LocalFilesystemURL(LocalFilesystemURL.FILESYSTEM_PROTOCOL + "://localhost/"+this.name+"/"+fullPath);
}
return null;
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/src/android/LocalFilesystemURL.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystemURL.java b/src/android/LocalFilesystemURL.java
index 1065382..a3aade8 100644
--- a/src/android/LocalFilesystemURL.java
+++ b/src/android/LocalFilesystemURL.java
@@ -3,6 +3,9 @@ package org.apache.cordova.file;
import android.net.Uri;
public class LocalFilesystemURL {
+
+ public static final String FILESYSTEM_PROTOCOL = "filesystem";
+
public static final int TEMPORARY = 0;
public static final int PERSISTENT = 1;
@@ -31,7 +34,7 @@ public class LocalFilesystemURL {
}
private int filesystemTypeForLocalURL(Uri URL) {
- if ("filesystem".equals(URL.getScheme()) && "localhost".equals(URL.getHost())) {
+ if (FILESYSTEM_PROTOCOL.equals(URL.getScheme()) && "localhost".equals(URL.getHost())) {
String path = URL.getPath();
if (path != null) {
if (path.startsWith("/temporary")) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/src/ios/CDVFile.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.h b/src/ios/CDVFile.h
index 1f2c812..0693f68 100644
--- a/src/ios/CDVFile.h
+++ b/src/ios/CDVFile.h
@@ -21,6 +21,7 @@
#import <Cordova/CDVPlugin.h>
NSString* const kCDVAssetsLibraryPrefix;
+NSString* const kCDVFilesystemURLPrefix;
enum CDVFileError {
NO_ERROR = 0,
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/src/ios/CDVFile.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m
index e53733d..7bc39b9 100644
--- a/src/ios/CDVFile.m
+++ b/src/ios/CDVFile.m
@@ -30,6 +30,8 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import)
NSString* const NSURLIsExcludedFromBackupKey = @"NSURLIsExcludedFromBackupKey";
#endif
+NSString* const kCDVFilesystemURLPrefix = @"filesystem";
+
@implementation CDVFilesystemURL
@synthesize url=_url;
@synthesize fileSystemType=_fileSystemType;
@@ -62,7 +64,7 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import)
*/
- (CDVFileSystemType)filesystemTypeForLocalURI:(NSURL *)uri
{
- if ([[uri scheme] isEqualToString:@"filesystem"] && [[uri host] isEqualToString:@"localhost"]) {
+ if ([[uri scheme] isEqualToString:kCDVFilesystemURLPrefix] && [[uri host] isEqualToString:@"localhost"]) {
if ([[uri path] hasPrefix:@"/temporary"]) {
return TEMPORARY;
} else if ([[uri path] hasPrefix:@"/persistent"]) {
@@ -106,8 +108,6 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import)
@implementation CDVFilesystemURLProtocol
-NSString* const kCDVFilesystemURLPrefix = @"filesystem";
-
+ (BOOL)canInitWithRequest:(NSURLRequest*)request
{
NSURL* url = [request URL];
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/src/ios/CDVLocalFilesystem.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m
index 6b409c9..5ad2200 100644
--- a/src/ios/CDVLocalFilesystem.m
+++ b/src/ios/CDVLocalFilesystem.m
@@ -106,7 +106,7 @@
{
NSString *fullPath = [self fullPathForFileSystemPath:path];
if (fullPath) {
- return [CDVFilesystemURL fileSystemURLWithString:[NSString stringWithFormat:@"filesystem://localhost/%@%@", self.name, fullPath]];
+ return [CDVFilesystemURL fileSystemURLWithString:[NSString stringWithFormat:@"%@://localhost/%@%@", kCDVFilesystemURLPrefix, self.name, fullPath]];
}
return nil;
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/www/android/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/android/FileSystem.js b/www/android/FileSystem.js
index 765d4f4..2099a99 100644
--- a/www/android/FileSystem.js
+++ b/www/android/FileSystem.js
@@ -19,10 +19,12 @@
*
*/
+FILESYSTEM_PROTOCOL = "filesystem";
+
module.exports = {
__format__: function(fullPath) {
var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+encodeURI(fullPath)).replace('//','/');
- return 'filesystem://localhost' + path;
+ return FILESYSTEM_PROTOCOL + '://localhost' + path;
}
};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2a225e32/www/ios/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js
index 765d4f4..2099a99 100644
--- a/www/ios/FileSystem.js
+++ b/www/ios/FileSystem.js
@@ -19,10 +19,12 @@
*
*/
+FILESYSTEM_PROTOCOL = "filesystem";
+
module.exports = {
__format__: function(fullPath) {
var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+encodeURI(fullPath)).replace('//','/');
- return 'filesystem://localhost' + path;
+ return FILESYSTEM_PROTOCOL + '://localhost' + path;
}
};
[2/6] git commit: Android: Make clear that getFile takes a path,
not just a filename
Posted by ia...@apache.org.
Android: Make clear that getFile takes a path, not just a filename
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/d8b728ac
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d8b728ac
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d8b728ac
Branch: refs/heads/dev
Commit: d8b728ac2d4eb14998ddf61599816029802bb001
Parents: 9ec003a
Author: Ian Clelland <ic...@chromium.org>
Authored: Sat Jan 11 09:45:03 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Sat Jan 11 09:45:03 2014 -0500
----------------------------------------------------------------------
src/android/FileUtils.java | 14 +++++++-------
src/android/Filesystem.java | 2 +-
src/android/LocalFilesystem.java | 10 +++++-----
3 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d8b728ac/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index d1c1b59..b04c901 100644
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -295,20 +295,20 @@ public class FileUtils extends CordovaPlugin {
}
else if (action.equals("getDirectory")) {
final String dirname=args.getString(0);
- final String fname=args.getString(1);
+ final String path=args.getString(1);
threadhelper( new FileOp( ){
public void run() throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
- JSONObject obj = getFile(dirname, fname, args.optJSONObject(2), true);
+ JSONObject obj = getFile(dirname, path, args.optJSONObject(2), true);
callbackContext.success(obj);
}
},callbackContext);
}
else if (action.equals("getFile")) {
final String dirname=args.getString(0);
- final String fname=args.getString(1);
+ final String path=args.getString(1);
threadhelper( new FileOp( ){
public void run() throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
- JSONObject obj = getFile(dirname, fname, args.optJSONObject(2), false);
+ JSONObject obj = getFile(dirname, path, args.optJSONObject(2), false);
callbackContext.success(obj);
}
},callbackContext);
@@ -618,7 +618,7 @@ public class FileUtils extends CordovaPlugin {
* Creates or looks up a file.
*
* @param baseURLstr base directory
- * @param fileName file/directory to lookup or create
+ * @param path file/directory to lookup or create
* @param options specify whether to create or not
* @param directory if true look up directory, if false look up file
* @return a Entry object
@@ -628,14 +628,14 @@ public class FileUtils extends CordovaPlugin {
* @throws EncodingException
* @throws JSONException
*/
- private JSONObject getFile(String baseURLstr, String fileName, JSONObject options, boolean directory) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
+ private JSONObject getFile(String baseURLstr, String path, JSONObject options, boolean directory) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
try {
LocalFilesystemURL inputURL = new LocalFilesystemURL(baseURLstr);
Filesystem fs = this.filesystemForURL(inputURL);
if (fs == null) {
throw new MalformedURLException("No installed handlers for this URL");
}
- return fs.getFileForLocalURL(inputURL, fileName, options, directory);
+ return fs.getFileForLocalURL(inputURL, path, options, directory);
} catch (IllegalArgumentException e) {
throw new MalformedURLException("Unrecognized filesystem URL");
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d8b728ac/src/android/Filesystem.java
----------------------------------------------------------------------
diff --git a/src/android/Filesystem.java b/src/android/Filesystem.java
index 1f869c9..6aa5860 100644
--- a/src/android/Filesystem.java
+++ b/src/android/Filesystem.java
@@ -41,7 +41,7 @@ public abstract class Filesystem {
abstract JSONObject getEntryForLocalURL(LocalFilesystemURL inputURL) throws IOException;
- abstract JSONObject getFileForLocalURL(LocalFilesystemURL inputURL, String fileName,
+ abstract JSONObject getFileForLocalURL(LocalFilesystemURL inputURL, String path,
JSONObject options, boolean directory) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException;
abstract boolean removeFileAtLocalURL(LocalFilesystemURL inputURL) throws InvalidModificationException, NoModificationAllowedException;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d8b728ac/src/android/LocalFilesystem.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystem.java b/src/android/LocalFilesystem.java
index f0d919f..c16aefe 100644
--- a/src/android/LocalFilesystem.java
+++ b/src/android/LocalFilesystem.java
@@ -33,7 +33,7 @@ public class LocalFilesystem extends Filesystem {
@Override
public String filesystemPathForURL(LocalFilesystemURL url) {
- String path = this.fsRoot + url.fullPath;
+ String path = new File(this.fsRoot, url.fullPath).toString();
if (path.endsWith("/")) {
path = path.substring(0, path.length()-1);
}
@@ -66,7 +66,7 @@ public class LocalFilesystem extends Filesystem {
@Override
public JSONObject getEntryForLocalURL(LocalFilesystemURL inputURL) throws IOException {
- File fp = new File(this.fsRoot + inputURL.fullPath); //TODO: Proper fs.join
+ File fp = new File(this.fsRoot, inputURL.fullPath);
if (!fp.exists()) {
throw new FileNotFoundException();
@@ -91,7 +91,7 @@ public class LocalFilesystem extends Filesystem {
@Override
public JSONObject getFileForLocalURL(LocalFilesystemURL inputURL,
- String fileName, JSONObject options, boolean directory) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
+ String path, JSONObject options, boolean directory) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
boolean create = false;
boolean exclusive = false;
@@ -103,8 +103,8 @@ public class LocalFilesystem extends Filesystem {
}
// Check for a ":" character in the file to line up with BB and iOS
- if (fileName.contains(":")) {
- throw new EncodingException("This file has a : in it's name");
+ if (path.contains(":")) {
+ throw new EncodingException("This path has an invalid \":\" in it.");
}
LocalFilesystemURL requestedURL = new LocalFilesystemURL(Uri.withAppendedPath(inputURL.URL, fileName));
[6/6] git commit: Change default FS URL scheme to "cdvfile"
Posted by ia...@apache.org.
Change default FS URL scheme to "cdvfile"
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/9d528160
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/9d528160
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/9d528160
Branch: refs/heads/dev
Commit: 9d528160e42d57c6b99afb3fef97a5b3215b9acb
Parents: 73dbfb6
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Jan 13 09:34:01 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Jan 13 10:10:47 2014 -0500
----------------------------------------------------------------------
src/android/LocalFilesystemURL.java | 2 +-
src/ios/CDVFile.m | 2 +-
www/android/FileSystem.js | 2 +-
www/ios/FileSystem.js | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9d528160/src/android/LocalFilesystemURL.java
----------------------------------------------------------------------
diff --git a/src/android/LocalFilesystemURL.java b/src/android/LocalFilesystemURL.java
index a3aade8..2aec395 100644
--- a/src/android/LocalFilesystemURL.java
+++ b/src/android/LocalFilesystemURL.java
@@ -4,7 +4,7 @@ import android.net.Uri;
public class LocalFilesystemURL {
- public static final String FILESYSTEM_PROTOCOL = "filesystem";
+ public static final String FILESYSTEM_PROTOCOL = "cdvfile";
public static final int TEMPORARY = 0;
public static final int PERSISTENT = 1;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9d528160/src/ios/CDVFile.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m
index 7bc39b9..500acb1 100644
--- a/src/ios/CDVFile.m
+++ b/src/ios/CDVFile.m
@@ -30,7 +30,7 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import)
NSString* const NSURLIsExcludedFromBackupKey = @"NSURLIsExcludedFromBackupKey";
#endif
-NSString* const kCDVFilesystemURLPrefix = @"filesystem";
+NSString* const kCDVFilesystemURLPrefix = @"cdvfile";
@implementation CDVFilesystemURL
@synthesize url=_url;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9d528160/www/android/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/android/FileSystem.js b/www/android/FileSystem.js
index d0db194..73332f8 100644
--- a/www/android/FileSystem.js
+++ b/www/android/FileSystem.js
@@ -19,7 +19,7 @@
*
*/
-FILESYSTEM_PROTOCOL = "filesystem";
+FILESYSTEM_PROTOCOL = "cdvfile";
module.exports = {
__format__: function(fullPath) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9d528160/www/ios/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js
index 2099a99..b11d58f 100644
--- a/www/ios/FileSystem.js
+++ b/www/ios/FileSystem.js
@@ -19,7 +19,7 @@
*
*/
-FILESYSTEM_PROTOCOL = "filesystem";
+FILESYSTEM_PROTOCOL = "cdvfile";
module.exports = {
__format__: function(fullPath) {
[5/6] git commit: Android: Properly format content urls
Posted by ia...@apache.org.
Android: Properly format content urls
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/73dbfb6c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/73dbfb6c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/73dbfb6c
Branch: refs/heads/dev
Commit: 73dbfb6c1f0b42b9825e08856b8da277f0b30450
Parents: 2a225e3
Author: Ian Clelland <ic...@chromium.org>
Authored: Sat Jan 11 09:58:08 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Jan 13 10:10:47 2014 -0500
----------------------------------------------------------------------
www/android/FileSystem.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73dbfb6c/www/android/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/android/FileSystem.js b/www/android/FileSystem.js
index 2099a99..d0db194 100644
--- a/www/android/FileSystem.js
+++ b/www/android/FileSystem.js
@@ -23,6 +23,9 @@ FILESYSTEM_PROTOCOL = "filesystem";
module.exports = {
__format__: function(fullPath) {
+ if (this.name === 'content') {
+ return 'content:/' + encodeURI(fullPath);
+ }
var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+encodeURI(fullPath)).replace('//','/');
return FILESYSTEM_PROTOCOL + '://localhost' + path;
}
[3/6] git commit: Android: Allow absolute paths on Entry.getFile /
Entry.getDirectory
Posted by ia...@apache.org.
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 <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));