Skip to content

Commit

Permalink
File Changes needed for iOS to pass mobile-spec file tests
Browse files Browse the repository at this point in the history
Need to have device specific File object
Need to call decodeURIComponent() on file read result
iOS code expects URI's in format of file://localhost so modified toURL. Need to work out fullPath format so all platforms are the same
  • Loading branch information
Becky Gibson authored and filmaj committed Mar 15, 2012
1 parent 94b7fb0 commit 8a74c56
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/platform/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ module.exports = {
MediaError: { // exists natively, override
path: "cordova/plugin/MediaError"
},
File: { // exists natively , override
path: "cordova/plugin/File"
},
device: {
path: 'cordova/plugin/ios/device'
},
Expand Down
4 changes: 3 additions & 1 deletion lib/plugin/Entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
*/
Entry.prototype.toURL = function() {
// fullPath attribute contains the full URL
return this.fullPath;
//return this.fullPath;
// *** iOS specific
return "file://localhost" + this.fullPath;
};

/**
Expand Down
4 changes: 3 additions & 1 deletion lib/plugin/FileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ FileReader.prototype.readAsText = function(file, encoding) {
}

// Save result
me.result = r;
//me.result = r;
// *** iOS specific
me.result = decodeURIComponent(r);

// If onload callback
if (typeof me.onload === "function") {
Expand Down

0 comments on commit 8a74c56

Please sign in to comment.