You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/15 20:36:25 UTC

[21/21] git commit: File Changes needed for iOS to pass mobile-spec file tests

File Changes needed for iOS to pass mobile-spec file tests

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/8a74c56c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/8a74c56c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/8a74c56c

Branch: refs/heads/master
Commit: 8a74c56c233834acccd08faf8d4b258d1a013588
Parents: 94b7fb0
Author: Becky Gibson <be...@apache.org>
Authored: Fri Mar 9 16:35:15 2012 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu Mar 15 10:14:41 2012 -0700

----------------------------------------------------------------------
 lib/platform/ios.js      |    3 +++
 lib/plugin/Entry.js      |    4 +++-
 lib/plugin/FileReader.js |    4 +++-
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8a74c56c/lib/platform/ios.js
----------------------------------------------------------------------
diff --git a/lib/platform/ios.js b/lib/platform/ios.js
index d99c3e9..b402633 100644
--- a/lib/platform/ios.js
+++ b/lib/platform/ios.js
@@ -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'
         },

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8a74c56c/lib/plugin/Entry.js
----------------------------------------------------------------------
diff --git a/lib/plugin/Entry.js b/lib/plugin/Entry.js
index f748dcc..b3acd8a 100644
--- a/lib/plugin/Entry.js
+++ b/lib/plugin/Entry.js
@@ -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;
 };
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8a74c56c/lib/plugin/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/plugin/FileReader.js b/lib/plugin/FileReader.js
index 8b634d9..6f7d422 100644
--- a/lib/plugin/FileReader.js
+++ b/lib/plugin/FileReader.js
@@ -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") {