cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] git commit: fix the Windows 8 implementation of the getFile method
Date Tue, 29 Apr 2014 00:16:28 GMT
Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master 69e465a4f -> 272d27ef5


fix the Windows 8  implementation of the getFile method

The storageFolder.getFileAsync(name) does not accept relative paths, only a simple file name...


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/22a42c97
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/22a42c97
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/22a42c97

Branch: refs/heads/master
Commit: 22a42c97dfe4b454041ae710f2bcb03c02ca7d4f
Parents: 3d7eb3e
Author: Melvyn <mlaily@gismartware.com>
Authored: Tue Apr 8 15:33:42 2014 +0200
Committer: Melvyn <mlaily@gismartware.com>
Committed: Tue Apr 8 15:33:42 2014 +0200

----------------------------------------------------------------------
 src/windows8/FileProxy.js | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/22a42c97/src/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/FileProxy.js b/src/windows8/FileProxy.js
index e564626..df79cef 100644
--- a/src/windows8/FileProxy.js
+++ b/src/windows8/FileProxy.js
@@ -376,10 +376,21 @@ module.exports = {
     },
 
     getFile:function(win,fail,args) {
-        var fullPath = args[0];
-        var path = args[1];
+		//not sure why, but it won't work with normal slashes...
+		var fullPath = args[0].replace(/\//g, '\\');
+        var path = args[1].replace(/\//g, '\\');
         var options = args[2];
 
+        var completePath = fullPath + '\\' + path;
+		//handles trailing slash and leading slash, or just one or the other
+        completePath = completePath.replace(/\\\\\\/g, '/').replace(/\\\\/g, '\\');
+
+        var fileName = completePath.substring(completePath.lastIndexOf('\\'));
+		
+		//final adjustment
+        fullPath = completePath.substring(0, completePath.lastIndexOf('\\'));
+        path = fileName.replace(/\\/g, '');
+
         var flag = "";
         if (options !== null) {
             flag = new Flags(options.create, options.exclusive);


Mime
View raw message