You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2012/03/01 02:24:57 UTC
[1/2] android commit: Merged cordova.android.js. Please move fixes to
the cordova-js project
Updated Branches:
refs/heads/master 21b734627 -> 7bf35e9c8
Merged cordova.android.js. Please move fixes to the cordova-js project
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/7bf35e9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/7bf35e9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/7bf35e9c
Branch: refs/heads/master
Commit: 7bf35e9c83ca9621b761f887103b79b22e024f8d
Parents: adb871f 21b7346
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Feb 29 17:24:04 2012 -0800
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Feb 29 17:24:04 2012 -0800
----------------------------------------------------------------------
framework/assets/js/cordova.android.js | 193 ++++++++++--------
framework/src/org/apache/cordova/FileUtils.java | 22 ++-
2 files changed, 120 insertions(+), 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/7bf35e9c/framework/assets/js/cordova.android.js
----------------------------------------------------------------------
diff --cc framework/assets/js/cordova.android.js
index 5d0879a,a386473..1f6847a
mode 100755,100644..100644
--- a/framework/assets/js/cordova.android.js
+++ b/framework/assets/js/cordova.android.js
@@@ -2168,7 -2262,10 +2168,10 @@@ DirectoryEntry.prototype.getDirectory
* @param {Function} errorCallback is called with a FileError
*/
DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) {
- exec(successCallback, errorCallback, "File", "removeRecursively", [this.fullPath]);
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
++ var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ errorCallback(new FileError(code));
+ };
+ exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]);
};
/**
@@@ -2230,7 -2327,10 +2233,10 @@@ DirectoryReader.prototype.readEntries
}
successCallback(retVal);
};
- exec(win, errorCallback, "File", "readEntries", [this.fullPath]);
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
++ var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ errorCallback(new FileError(code));
+ };
+ exec(win, fail, "File", "readEntries", [this.path]);
};
module.exports = DirectoryReader;
@@@ -2277,8 -2377,11 +2283,11 @@@ Entry.prototype.getMetadata = function(
var metadata = new Metadata(lastModified);
successCallback(metadata);
};
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
++ var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ errorCallback(new FileError(code));
+ };
- exec(success, errorCallback, "File", "getMetadata", [this.fullPath]);
+ exec(success, fail, "File", "getMetadata", [this.fullPath]);
};
/**
@@@ -2420,7 -2529,10 +2431,10 @@@ Entry.prototype.remove = function(succe
* @param errorCallback {Function} called with a FileError
*/
Entry.prototype.getParent = function(successCallback, errorCallback) {
- exec(successCallback, errorCallback, "File", "getParent", [this.fullPath]);
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
++ var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ errorCallback(new FileError(code));
+ };
+ exec(successCallback, fail, "File", "getParent", [this.fullPath]);
};
module.exports = Entry;
@@@ -3803,25 -3949,31 +3815,30 @@@ var FileError = require('cordova/plugin
* @param errorCallback invoked if error occurs retrieving file system
*/
var requestFileSystem = function(type, size, successCallback, errorCallback) {
- if (type < 0 || type > 3) {
- if (typeof errorCallback === "function") {
- errorCallback(new FileError(FileError.SYNTAX_ERR));
- }
- } else {
- // if successful, return a FileSystem object
- var success = function(file_system) {
- if (file_system) {
- // grab the name and root from the file system object
- var result = new FileSystem(file_system.name, file_system.root);
- successCallback(result);
- }
- else {
- // no FileSystem object returned
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
+ var fail = function(code) {
+ if (typeof errorCallback === 'function') {
+ errorCallback(new FileError(code));
+ }
};
- exec(success, errorCallback, "File", "requestFileSystem", [type, size]);
- }
-
+ if (type < 0 || type > 3) {
+ fail(FileError.SYNTAX_ERR);
+ } else {
+ // if successful, return a FileSystem object
+ var success = function(file_system) {
+ if (file_system) {
+ if (typeof successCallback === 'function') {
+ // grab the name and root from the file system object
+ var result = new FileSystem(file_system.name, file_system.root);
+ successCallback(result);
+ }
+ }
+ else {
+ // no FileSystem object returned
+ fail(FileError.NOT_FOUND_ERR);
+ }
+ };
+ exec(success, fail, "File", "requestFileSystem", [type, size]);
+ }
};
module.exports = requestFileSystem;