Skip to content

Commit

Permalink
CB-421 - FileAPI: getParent() does not return a valid DirectoryEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
macdonst committed Apr 2, 2012
1 parent e49628e commit 4e4e117
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/common/plugin/Entry.js
Expand Up @@ -189,10 +189,15 @@ Entry.prototype.remove = function(successCallback, errorCallback) {
* @param errorCallback {Function} called with a FileError
*/
Entry.prototype.getParent = function(successCallback, errorCallback) {
var win = typeof successCallback !== 'function' ? null : function(result) {
var DirectoryEntry = require('cordova/plugin/DirectoryEntry');
var entry = new DirectoryEntry(result.name, result.fullPath);
successCallback(entry);
};
var fail = typeof errorCallback !== 'function' ? null : function(code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, "File", "getParent", [this.fullPath]);
exec(win, fail, "File", "getParent", [this.fullPath]);
};

module.exports = Entry;

0 comments on commit 4e4e117

Please sign in to comment.