incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [20/45] js commit: Fixed more typos and bugs
Date Sat, 06 Oct 2012 09:19:20 GMT
Fixed more typos and bugs


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/a43bf481
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/a43bf481
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/a43bf481

Branch: refs/heads/master
Commit: a43bf4810da5f7536e1428fb0235e2e648e3a0f0
Parents: 4c6cde2
Author: mpberk <matthew.p.berk@intel.com>
Authored: Wed Sep 26 12:14:34 2012 -0700
Committer: mpberk <matthew.p.berk@intel.com>
Committed: Wed Sep 26 12:14:34 2012 -0700

----------------------------------------------------------------------
 lib/windows8/exec.js                              |    2 +-
 lib/windows8/platform.js                          |   12 +-
 lib/windows8/plugin/windows8/CameraProxy.js       |    3 +-
 lib/windows8/plugin/windows8/CaptureProxy.js      |    5 +-
 lib/windows8/plugin/windows8/FileProxy.js         |  786 ++++++++++++++++
 lib/windows8/plugin/windows8/FileTransferProxy.js |    7 +-
 lib/windows8/plugin/windows8/file.js              |  774 ---------------
 lib/windows8/plugin/windows8/geolocation.js       |    2 +-
 8 files changed, 799 insertions(+), 792 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/exec.js
----------------------------------------------------------------------
diff --git a/lib/windows8/exec.js b/lib/windows8/exec.js
index 6a53247..da6d35a 100644
--- a/lib/windows8/exec.js
+++ b/lib/windows8/exec.js
@@ -31,7 +31,7 @@ var CommandProxy  = {
     "Capture":require('cordova/plugin/windows8/CaptureProxy'),
     "Compass":require('cordova/plugin/windows8/CompassProxy'),
     "Device":require('cordova/plugin/windows8/DeviceProxy'),
-    "File":require('cordova/plugin/windows8/file'),
+    "File":require('cordova/plugin/windows8/FileProxy'),
     "FileTransfer":require('cordova/plugin/windows8/FileTransferProxy'),
     "Media":require('cordova/plugin/windows8/MediaProxy'),
     "NetworkStatus":require('cordova/plugin/windows8/NetworkStatusProxy'),

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/platform.js
----------------------------------------------------------------------
diff --git a/lib/windows8/platform.js b/lib/windows8/platform.js
index d4673c2..89f9253 100644
--- a/lib/windows8/platform.js
+++ b/lib/windows8/platform.js
@@ -11,10 +11,10 @@ module.exports = {
         navigator: {
             children: {
                 device: {
-                    path:"cordova/plugin/windows8/device",
-                    children:{
-                        capture:{
-                            path:"cordova/plugin/capture"
+                    path: "cordova/plugin/windows8/device",
+                    children: {
+                        capture: {
+                            path: "cordova/plugin/capture"
                         }
                     }
                 },
@@ -23,12 +23,8 @@ module.exports = {
                 }
             }
         }
-
     },
     merges: {
-        file: {
-            path: 'cordova/plugin/windows8/file'
-        },
         navigator: {
             children: {
                 geolocation: {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/plugin/windows8/CameraProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/CameraProxy.js b/lib/windows8/plugin/windows8/CameraProxy.js
index a1fbf51..e521ae8 100644
--- a/lib/windows8/plugin/windows8/CameraProxy.js
+++ b/lib/windows8/plugin/windows8/CameraProxy.js
@@ -3,7 +3,8 @@
 
 var cordova = require('cordova'),
     Camera = require('cordova/plugin/CameraConstants'),
-    FileEntry = require('cordova/plugin/FileEntry');
+    FileEntry = require('cordova/plugin/FileEntry'),
+    FileError = require('cordova/plugin/FileError');
 
 
 module.exports = {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/plugin/windows8/CaptureProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/CaptureProxy.js b/lib/windows8/plugin/windows8/CaptureProxy.js
index 36af365..c39398a 100644
--- a/lib/windows8/plugin/windows8/CaptureProxy.js
+++ b/lib/windows8/plugin/windows8/CaptureProxy.js
@@ -7,9 +7,6 @@ var MediaFileData = require('cordova/plugin/MediaFileData');
 
 module.exports = {
 
-    // No UI support. The duration of the audio recording.
-    cameraCaptureAudioDuration: null,
-
     captureAudio:function(successCallback, errorCallback, args) {
         var options = args[0];
         var audioOptions = new CaptureAudioOptions();
@@ -21,7 +18,7 @@ module.exports = {
             errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
             return;
         }
-        cameraCaptureAudioDuration = audioOptions.duration;
+        var cameraCaptureAudioDuration = audioOptions.duration;
 
         var mediaCaputreSettings;
         var initCaptureSettings = function () {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/plugin/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/FileProxy.js b/lib/windows8/plugin/windows8/FileProxy.js
new file mode 100644
index 0000000..61fabe7
--- /dev/null
+++ b/lib/windows8/plugin/windows8/FileProxy.js
@@ -0,0 +1,786 @@
+var Entry = require('cordova/plugins/Entry'),
+    File = require('cordova/plugins/File'),
+    FileEntry = require('cordova/plugins/FireEntry'),
+    FileError = require('cordova/plugins/FireError'),
+    DirectoryEntry = require('cordova/plugins/DirectoryEntry'),
+    Flags = require('cordova/plugins/Flags');
+//var cordova = require('cordova');
+
+
+module.exports = {
+
+    getFileMetaData:function(win,fail,args) {
+        var fullPath = args[0];
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).done(
+            function (storageFile) {
+                storageFile.getBasicPropertiesAsync().then(
+                    function (basicProperties) {
+                        win(new File(storageFile.name, storageFile.path, storageFile.fileType, basicProperties.dateModified, basicProperties.size));
+                    }, function () {
+                        fail(FileError.NOT_READABLE_ERR);
+                    }
+                );
+            }, function () {
+                fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    getMetadata:function(success,fail,args) {
+        var fullPath = args[0];
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).then(
+            function (sFile) {
+                Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).done(
+                    function (storageFile) {
+                        storageFile.getBasicPropertiesAsync().then(
+                            function (basicProperties) {
+                                success(basicProperties.dateModified);
+                            },
+                            function () {
+                                fail(FileError.NOT_READABLE_ERR);
+                            }
+                        );
+                    },
+                    function () {
+                        fail(FileError.NOT_READABLE_ERR);
+                    }
+                );
+            },
+            function () {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+                    function (sFolder) {
+                        Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).done(
+                            function (storageFolder) {
+                                storageFolder.getBasicPropertiesAsync().then(
+                                    function (basicProperties) {
+                                        success(basicProperties.dateModified);
+                                    },
+                                    function () {
+                                        fail(FileError.NOT_FOUND_ERR);
+                                    }
+                                );
+                            },
+                            function () {
+                                fail(FileError.NOT_READABLE_ERR);
+                            }
+                        );
+                    }, function () {
+                        fail(FileError.NOT_FOUND_ERR);
+                    }
+                );
+            }
+        );
+    },
+
+    getParent:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+
+        var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
+        var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
+
+        if (fullPath == storageFolderPer.path) {
+            win(new DirectoryEntry(storageFolderPer.name, storageFolderPer.path));
+            return;
+        } else if (fullPath == storageFolderTem.path) {
+            win(new DirectoryEntry(storageFolderTem.name, storageFolderTem.path));
+            return;
+        }
+        var splitArr = fullPath.split(new RegExp(/\/|\\/g));
+
+        var popItem = splitArr.pop();
+
+        var result = new DirectoryEntry(popItem, fullPath.substr(0, fullPath.length - popItem.length - 1));
+        Windows.Storage.StorageFolder.getFolderFromPathAsync(result.fullPath).done(
+            function () { win(result); },
+            function () { fail(FileError.INVALID_STATE_ERR); }
+        );
+    },
+
+    readAsText:function(win,fail,args) {
+        var fileName = args[0];
+        var enc = args[1];
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fileName).done(
+            function (storageFile) {
+                var value = Windows.Storage.Streams.UnicodeEncoding.utf8;
+                if (enc == 'Utf16LE' || enc == 'utf16LE') {
+                    value = Windows.Storage.Streams.UnicodeEncoding.utf16LE;
+                }else if (enc == 'Utf16BE' || enc == 'utf16BE') {
+                    value = Windows.Storage.Streams.UnicodeEncoding.utf16BE;
+                }
+                Windows.Storage.FileIO.readTextAsync(storageFile, value).done(
+                    function (fileContent) {
+                        win(fileContent);
+                    },
+                    function () {
+                        fail(FileError.ENCODING_ERR);
+                    }
+                );
+            }, function () {
+                fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    readAsDataURL:function(win,fail,args) {
+        var fileName = args[0];
+
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fileName).then(
+            function (storageFile) {
+                Windows.Storage.FileIO.readBufferAsync(storageFile).done(
+                    function (buffer) {
+                        var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
+                        //the method encodeToBase64String will add "77u/" as a prefix, so we should remove it
+                        if(String(strBase64).substr(0,4) == "77u/") {
+                            strBase64 = strBase64.substr(4);
+                        }
+                        var mediaType = storageFile.contentType;
+                        var result = "data:" + mediaType + ";base64," + strBase64;
+                        win(result);
+                    }
+                );
+            }, function () {
+                fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    getDirectory:function(win,fail,args) {
+        var fullPath = args[0];
+        var path = args[1];
+        var options = args[2];
+
+        var flag = "";
+        if (options !== null) {
+            flag = new Flags(options.create, options.exclusive);
+        } else {
+            flag = new Flags(false, false);
+        }
+
+        path = String(path).split(" ").join("\ ");
+
+        Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+            function (storageFolder) {
+                if (flag.create === true && flag.exclusive === true) {
+                    storageFolder.createFolderAsync(path, Windows.Storage.CreationCollisionOption.failIfExists).done(
+                        function (storageFolder) {
+                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                        }, function () {
+                            fail(FileError.PATH_EXISTS_ERR);
+                        }
+                    );
+                } else if (flag.create === true && flag.exclusive === false) {
+                    storageFolder.createFolderAsync(path, Windows.Storage.CreationCollisionOption.openIfExists).done(
+                        function (storageFolder) {
+                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                        }, function () {
+                            fail(FileError.INVALID_MODIFICATION_ERR);
+                        }
+                    );
+                } else if (flag.create === false) {
+                    if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
+                        fail(FileError.ENCODING_ERR);
+                        return;
+                    }
+
+                    storageFolder.getFolderAsync(path).done(
+                        function (storageFolder) {
+                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                        }, function () {
+                            fail(FileError.NOT_FOUND_ERR);
+                        }
+                    );
+                }
+            }, function () {
+                fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    remove:function(win,fail,args) {
+        var fullPath = args[0];
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).then(
+            function (sFile) {
+                Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).done(function (storageFile) {
+                    storageFile.deleteAsync().done(win, function () {
+                        fail(FileError.INVALID_MODIFICATION_ERR);
+
+                    });
+                });
+            },
+            function () {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+                    function (sFolder) {
+                        var removeEntry = function () {
+                            var storageFolder = null;
+
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(function (storageFolder) {
+                                //FileSystem root can't be removed!
+                                var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
+                                var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
+                                if (fullPath == storageFolderPer.path || fullPath == storageFolderTem.path) {
+                                    fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+                                    return;
+                                }
+                                storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
+
+                                    if (fileList.length === 0) {
+                                        storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
+
+                                            if (folderList.length === 0) {
+                                                storageFolder.deleteAsync().done(win, function () {
+                                                    fail(FileError.INVALID_MODIFICATION_ERR);
+
+                                                });
+                                            } else {
+                                                fail(FileError.INVALID_MODIFICATION_ERR);
+                                            }
+                                        });
+                                    } else {
+                                        fail(FileError.INVALID_MODIFICATION_ERR);
+                                    }
+                                });
+
+                            }, function () {
+                                fail(FileError.INVALID_MODIFICATION_ERR);
+
+                            });
+
+
+                        };
+                        removeEntry();
+                    }, function () {
+                        fail(FileError.NOT_FOUND_ERR);
+                    }
+                );
+            }
+        );
+
+    },
+
+    removeRecursively:function(successCallback,fail,args) {
+        var fullPath = args[0];
+
+        Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).done(function (storageFolder) {
+        var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
+        var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
+
+        if (storageFolder.path == storageFolderPer.path || storageFolder.path == storageFolderTem.path) {
+            fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+            return;
+        }
+
+        var removeFolders = function (path) {
+            return new WinJS.Promise(function (complete) {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(function (storageFolder) {
+                    var fileListPromise = storageFolder.createFileQuery().getFilesAsync();
+                    var filePromiseArr = [];
+
+                    fileListPromise.then(function (fileList) {
+                        if (fileList !== null) {
+                            for (var i = 0; i < fileList.length; i++) {
+                                var filePromise = fileList[i].deleteAsync();
+                                filePromiseArr.push(filePromise);
+                            }
+                        }
+                        WinJS.Promise.join(filePromiseArr).then(function () {
+                            var folderListPromise = storageFolder.createFolderQuery().getFoldersAsync();
+                            folderListPromise.then(function (folderList) {
+                                var folderPromiseArr = [];
+                                if (folderList.length !== 0) {
+                                    for (var j = 0; j < folderList.length; j++) {
+
+                                        folderPromiseArr.push(removeFolders(folderList[j].path));
+                                    }
+                                    WinJS.Promise.join(folderPromiseArr).then(function () {
+                                        storageFolder.deleteAsync().then(complete);
+                                    });
+                                } else {
+                                    storageFolder.deleteAsync().then(complete);
+                                }
+                            }, function () { });
+                       });
+                    }, function () { });
+                });
+            });
+        };
+        removeFolders(storageFolder.path).then(function () {
+            Windows.Storage.StorageFolder.getFolderFromPathAsync(storageFolder.path).then(
+                function () {},
+                function () {
+                    if (typeof successCallback !== 'undefined' && successCallback !== null) { successCallback(); }
+                });
+            });
+        });
+    },
+
+    getFile:function(win,fail,args) {
+        var fullPath = args[0];
+        var path = args[1];
+        var options = args[2];
+
+        var flag = "";
+        if (options !== null) {
+            flag = new Flags(options.create, options.exclusive);
+        } else {
+            flag = new Flags(false, false);
+        }
+
+        path = String(path).split(" ").join("\ ");
+
+        Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+            function (storageFolder) {
+                if (flag.create === true && flag.exclusive === true) {
+                    storageFolder.createFileAsync(path, Windows.Storage.CreationCollisionOption.failIfExists).done(
+                        function (storageFile) {
+                            win(new FileEntry(storageFile.name, storageFile.path));
+                        }, function () {
+                            fail(FileError.PATH_EXISTS_ERR);
+                        }
+                    );
+                } else if (flag.create === true && flag.exclusive === false) {
+                    storageFolder.createFileAsync(path, Windows.Storage.CreationCollisionOption.openIfExists).done(
+                        function (storageFile) {
+                            win(new FileEntry(storageFile.name, storageFile.path));
+                        }, function () {
+                            fail(FileError.INVALID_MODIFICATION_ERR);
+                        }
+                    );
+                } else if (flag.create === false) {
+                    if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
+                        fail(FileError.ENCODING_ERR);
+                        return;
+                    }
+                    storageFolder.getFileAsync(path).done(
+                        function (storageFile) {
+                            win(new FileEntry(storageFile.name, storageFile.path));
+                        }, function () {
+                            fail(FileError.NOT_FOUND_ERR);
+                        }
+                    );
+                }
+            }, function () {
+                fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    readEntries:function(win,fail,args) { // ["fullPath"]
+        var path = args[0];
+
+        var result = [];
+
+        Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(function (storageFolder) {
+            var promiseArr = [];
+            var index = 0;
+            promiseArr[index++] = storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
+                if (fileList !== null) {
+                    for (var i = 0; i < fileList.length; i++) {
+                        result.push(new FileEntry(fileList[i].name, fileList[i].path));
+                    }
+                }
+            });
+            promiseArr[index++] = storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
+                if (folderList !== null) {
+                    for (var j = 0; j < folderList.length; j++) {
+                        result.push(new FileEntry(folderList[j].name, folderList[j].path));
+                    }
+                }
+            });
+            WinJS.Promise.join(promiseArr).then(function () {
+                win(result);
+            });
+
+        }, function () { fail(FileError.NOT_FOUND_ERR); });
+    },
+
+    write:function(win,fail,args) {
+        var fileName = args[0];
+        var text = args[1];
+        var position = args[2];
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fileName).done(
+            function (storageFile) {
+                Windows.Storage.FileIO.writeTextAsync(storageFile,text,Windows.Storage.Streams.UnicodeEncoding.utf8).done(
+                    function() {
+                        win(String(text).length);
+                    }, function () {
+                        fail(FileError.INVALID_MODIFICATION_ERR);
+                    }
+                );
+            }, function() {
+                fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    truncate:function(win,fail,args) { // ["fileName","size"]
+        var fileName = args[0];
+        var size = args[1];
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fileName).done(function(storageFile){
+            //the current length of the file.
+            var leng = 0;
+
+            storageFile.getBasicPropertiesAsync().then(function (basicProperties) {
+                leng = basicProperties.size;
+                if (Number(size) >= leng) {
+                    win(this.length);
+                    return;
+                }
+                if (Number(size) >= 0) {
+                    Windows.Storage.FileIO.readTextAsync(storageFile, Windows.Storage.Streams.UnicodeEncoding.utf8).then(function (fileContent) {
+                        fileContent = fileContent.substr(0, size);
+                        var fullPath = storageFile.path;
+                        var name = storageFile.name;
+                        var entry = new Entry(true, false, name, fullPath);
+                        var parentPath = "";
+                        do {
+                            var successCallBack = function (entry) {
+                                parentPath = entry.fullPath;
+                            };
+                            entry.getParent(successCallBack, null);
+                        }
+                        while (parentPath === "");
+                        storageFile.deleteAsync().then(function () {
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
+                                storageFolder.createFileAsync(name).then(function (newStorageFile) {
+                                    Windows.Storage.FileIO.writeTextAsync(newStorageFile, fileContent).done(function () {
+                                        win(String(fileContent).length);
+                                    }, function () {
+                                        fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+                                    });
+                                });
+                            });
+                        });
+                    }, function () { fail(FileError.NOT_FOUND_ERR); });
+                }
+            });
+        }, function () { fail(FileError.NOT_FOUND_ERR); });
+    },
+
+    copyTo:function(success,fail,args) { // ["fullPath","parent", "newName"]
+        var srcPath = args[0];
+        var parentFullPath = args[1];
+        var name = args[2];
+
+        //name can't be invalid
+        if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(name)) {
+            fail(FileError.ENCODING_ERR);
+            return;
+        }
+        // copy
+        var copyFiles = "";
+        Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(
+            function (sFile) {
+                copyFiles = function (srcPath, parentPath) {
+                    Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(function (storageFile) {
+                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
+                            storageFile.copyAsync(storageFolder, name, Windows.Storage.NameCollisionOption.failIfExists).then(function (storageFile) {
+
+                                success(new FileEntry(storageFile.name, storageFile.path));
+                            }, function () {
+
+                                fail(FileError.INVALID_MODIFICATION_ERR);
+                            });
+                        }, function () {
+
+                            fail(FileError.NOT_FOUND_ERR);
+                        });
+                    }, function () {
+
+                        fail(FileError.NOT_FOUND_ERR);
+                    });
+                };
+                var copyFinish = function (srcPath, parentPath) {
+                    copyFiles(srcPath, parentPath);
+                };
+                copyFinish(srcPath, parentFullPath);
+            },
+            function () {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(
+                    function (sFolder) {
+                        copyFiles = function (srcPath, parentPath) {
+                            return new WinJS.Promise(function (complete) {
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (storageFolder) {
+                                    storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
+                                        var filePromiseArr = [];
+                                        if (fileList) {
+                                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (targetStorageFolder) {
+                                                for (var i = 0; i < fileList.length; i++) {
+                                                    filePromiseArr.push(fileList[i].copyAsync(targetStorageFolder));
+                                                }
+                                                WinJS.Promise.join(filePromiseArr).then(function () {
+                                                    storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
+                                                        var folderPromiseArr = [];
+                                                        if (folderList.length === 0) { complete(); }
+                                                        else {
+
+                                                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolderTarget) {
+                                                                var tempPromiseArr = [];
+                                                                var index = 0;
+                                                                for (var j = 0; j < folderList.length; j++) {
+                                                                    tempPromiseArr[index++] = storageFolderTarget.createFolderAsync(folderList[j].name).then(function (targetFolder) {
+                                                                        folderPromiseArr.push(copyFiles(folderList[j].path, targetFolder.path));
+                                                                    });
+                                                                }
+                                                                WinJS.Promise.join(tempPromiseArr).then(function () {
+                                                                    WinJS.Promise.join(folderPromiseArr).then(complete);
+                                                                });
+                                                            });
+                                                        }
+                                                    });
+                                                });
+                                            });
+                                        }
+                                    });
+                                });
+                            });
+                        };
+                        var copyFinish = function (srcPath, parentPath) {
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
+                                storageFolder.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists).then(function (newStorageFolder) {
+                                    //can't copy onto itself
+                                    if (srcPath == newStorageFolder.path) {
+                                        fail(FileError.INVALID_MODIFICATION_ERR);
+                                        return;
+                                    }
+                                    //can't copy into itself
+                                    if (srcPath == parentPath) {
+                                        fail(FileError.INVALID_MODIFICATION_ERR);
+                                        return;
+                                    }
+                                    copyFiles(srcPath, newStorageFolder.path).then(function () {
+                                        Windows.Storage.StorageFolder.getFolderFromPathAsync(newStorageFolder.path).done(
+                                            function (storageFolder) {
+                                                success(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                                            },
+                                            function () { fail(FileError.NOT_FOUND_ERR); }
+                                        );
+                                    });
+                                }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
+                            }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
+                        };
+                        copyFinish(srcPath, parentFullPath);
+                    }, function () {
+                        fail(FileError.NOT_FOUND_ERR);
+                    }
+                );
+            }
+        );
+    },
+
+    moveTo:function(success,fail,args) {
+        var srcPath = args[0];
+        var parentFullPath = args[1];
+        var name = args[2];
+
+
+        //name can't be invalid
+        if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(name)) {
+            fail(FileError.ENCODING_ERR);
+            return;
+        }
+
+        var moveFiles = "";
+        Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(
+            function (sFile) {
+                moveFiles = function (srcPath, parentPath) {
+                    Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(function (storageFile) {
+                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
+                            storageFile.moveAsync(storageFolder, name, Windows.Storage.NameCollisionOption.replaceExisting).then(function () {
+                                success(new FileEntry(name, storageFile.path));
+                            }, function () {
+                                fail(FileError.INVALID_MODIFICATION_ERR);
+                            });
+                        }, function () {
+                            fail(FileError.NOT_FOUND_ERR);
+                        });
+                    }, function () {
+                        fail(FileError.NOT_FOUND_ERR);
+                    });
+                };
+                var moveFinish = function (srcPath, parentPath) {
+                    //can't copy onto itself
+                    if (srcPath == parentPath + "\\" + name) {
+                        fail(FileError.INVALID_MODIFICATION_ERR);
+                        return;
+                    }
+                    moveFiles(srcPath, parentFullPath);
+                };
+                moveFinish(srcPath, parentFullPath);
+            },
+            function () {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(
+                    function (sFolder) {
+                        moveFiles = function (srcPath, parentPath) {
+                            return new WinJS.Promise(function (complete) {
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (storageFolder) {
+                                    storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
+                                        var filePromiseArr = [];
+                                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (dstStorageFolder) {
+                                            if (fileList) {
+                                                for (var i = 0; i < fileList.length; i++) {
+                                                    filePromiseArr.push(fileList[i].moveAsync(dstStorageFolder));
+                                                }
+                                            }
+                                            WinJS.Promise.join(filePromiseArr).then(function () {
+                                                storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
+                                                    var folderPromiseArr = [];
+                                                    if (folderList.length === 0) {
+                                                        // If failed, we must cancel the deletion of folders & files.So here wo can't delete the folder.
+                                                        complete();
+                                                    }
+                                                    else {
+                                                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolderTarget) {
+                                                            var tempPromiseArr = [];
+                                                            var index = 0;
+                                                            for (var j = 0; j < folderList.length; j++) {
+                                                                tempPromiseArr[index++] = storageFolderTarget.createFolderAsync(folderList[j].name).then(function (targetFolder) {
+                                                                    folderPromiseArr.push(moveFiles(folderList[j].path, targetFolder.path));
+                                                                });
+                                                            }
+                                                            WinJS.Promise.join(tempPromiseArr).then(function () {
+                                                                WinJS.Promise.join(folderPromiseArr).then(complete);
+                                                            });
+                                                        });
+                                                    }
+                                                });
+                                            }, function () { });
+                                        });
+                                    });
+                                });
+                            });
+                        };
+                        var moveFinish = function (srcPath, parentPath) {
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (originFolder) {
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
+                                    storageFolder.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists).then(function (newStorageFolder) {
+                                        //can't move onto directory that is not empty
+                                        newStorageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
+                                            newStorageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
+                                                if (fileList.length !== 0 || folderList.length !== 0) {
+                                                    fail(FileError.INVALID_MODIFICATION_ERR);
+                                                    return;
+                                                }
+                                                //can't copy onto itself
+                                                if (srcPath == newStorageFolder.path) {
+                                                    fail(FileError.INVALID_MODIFICATION_ERR);
+                                                    return;
+                                                }
+                                                //can't copy into itself
+                                                if (srcPath == parentPath) {
+                                                    fail(FileError.INVALID_MODIFICATION_ERR);
+                                                    return;
+                                                }
+                                                moveFiles(srcPath, newStorageFolder.path).then(function () {
+                                                    var successCallback = function () {
+                                                        success(new DirectoryEntry(name, newStorageFolder.path));
+                                                        };
+                                                    var temp = new DirectoryEntry(originFolder.name, originFolder.path).removeRecursively(successCallback, fail);
+
+                                                }, function () { console.log("error!"); });
+                                            });
+                                        });
+                                    }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
+                                }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
+                            }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
+
+                        };
+                        moveFinish(srcPath, parentFullPath);
+                    }, function () {
+                        fail(FileError.NOT_FOUND_ERR);
+                    }
+                );
+            }
+        );
+    },
+
+    tempFileSystem:null,
+
+    persistentFileSystem:null,
+
+    requestFileSystem:function(win,fail,args) {
+        var type = args[0];
+        var size = args[1];
+
+        var filePath = "";
+        var result = null;
+        var fsTypeName = "";
+
+        switch (type) {
+            case LocalFileSystem.TEMPORARY:
+                filePath = Windows.Storage.ApplicationData.current.temporaryFolder.path;
+                fsTypeName = "temporary";
+                break;
+            case LocalFileSystem.PERSISTENT:
+                filePath = Windows.Storage.ApplicationData.current.localFolder.path;
+                fsTypeName = "persistent";
+                break;
+        }
+
+        var MAX_SIZE = 10000000000;
+        if (size > MAX_SIZE) {
+            fail(FileError.QUOTA_EXCEEDED_ERR);
+            return;
+        }
+
+        var fileSystem = new FileSystem(fsTypeName, new DirectoryEntry(fsTypeName, filePath));
+        result = fileSystem;
+        win(result);
+    },
+
+    resolveLocalFileSystemURI:function(success,fail,args) {
+        var uri = args[0];
+
+        var path = uri;
+        path = path.split(" ").join("\ ");
+
+        // support for file name with parameters
+        if (/\?/g.test(path)) {
+            path = String(path).split("\?")[0];
+        }
+
+        // support for encodeURI
+        if (/\%5/g.test(path)) {
+            path = decodeURI(path);
+        }
+
+        // support for special path start with file:///
+        if (path.substr(0, 8) == "file:///") {
+            path = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + String(path).substr(8).split("/").join("\\");
+            Windows.Storage.StorageFile.getFileFromPathAsync(path).then(
+                function (storageFile) {
+                    success(new FileEntry(storageFile.name, storageFile.path));
+                }, function () {
+                    Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
+                        function (storageFolder) {
+                            success(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                        }, function () {
+                            fail(FileError.NOT_FOUND_ERR);
+                        }
+                    );
+                }
+            );
+        } else {
+            Windows.Storage.StorageFile.getFileFromPathAsync(path).then(
+                function (storageFile) {
+                    success(new FileEntry(storageFile.name, storageFile.path));
+                }, function () {
+                    Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
+                        function (storageFolder) {
+                            success(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                        }, function () {
+                            fail(FileError.ENCODING_ERR);
+                        }
+                    );
+                }
+            );
+        }
+    }
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/plugin/windows8/FileTransferProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/FileTransferProxy.js b/lib/windows8/plugin/windows8/FileTransferProxy.js
index 301a7f7..78c19db 100644
--- a/lib/windows8/plugin/windows8/FileTransferProxy.js
+++ b/lib/windows8/plugin/windows8/FileTransferProxy.js
@@ -1,9 +1,10 @@
-var FileTransferError = require('cordova/plugin/FileTransferError');
-var FileUploadResult = require('cordova/plugin/FileUploadResult');
+var FileTransferError = require('cordova/plugin/FileTransferError'),
+    FileUploadResult = require('cordova/plugin/FileUploadResult'),
+    FileEntry = require('cordova/plugins/FireEntry');
 
 module.exports = {
 
-    upload:function(win, error, options) {
+    upload:function(successCallback, error, options) {
         var filePath = options[0];
         var server = options[1];
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/plugin/windows8/file.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/file.js b/lib/windows8/plugin/windows8/file.js
deleted file mode 100644
index c69ca6f..0000000
--- a/lib/windows8/plugin/windows8/file.js
+++ /dev/null
@@ -1,774 +0,0 @@
-var cordova = require('cordova');
-
-
-module.exports = { //Merges with common
-
-    getFileMetaData:function(win,fail,args) {
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).done(
-            function (storageFile) {
-                storageFile.getBasicPropertiesAsync().then(
-                    function (basicProperties) {
-                        win(new File(storageFile.name, storageFile.path, storageFile.fileType, basicProperties.dateModified, basicProperties.size));
-                    }, function () {
-                        fail(FileError.NOT_READABLE_ERR);
-                    }
-                );
-            }, function () {
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        );
-    },
-
-    getMetadata:function(success,fail,args) {
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(
-            function (sFile) {
-                Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).done(
-                    function (storageFile) {
-                        storageFile.getBasicPropertiesAsync().then(
-                            function (basicProperties) {
-                                success(basicProperties.dateModified);
-                            },
-                            function () {
-                                fail(FileError.NOT_READABLE_ERR);
-                            }
-                        );
-                    },
-                    function () {
-                        fail(FileError.NOT_READABLE_ERR);
-                    }
-                );
-            },
-            function () {
-                Windows.Storage.StorageFolder.getFolderFromPathAsync(args[0]).then(
-                    function (sFolder) {
-                        Windows.Storage.StorageFolder.getFolderFromPathAsync(args[0]).done(
-                            function (storageFolder) {
-                                storageFolder.getBasicPropertiesAsync().then(
-                                    function (basicProperties) {
-                                        success(basicProperties.dateModified);
-                                    },
-                                    function () {
-                                        fail(FileError.NOT_FOUND_ERR);
-                                    }
-                                );
-                            },
-                            function () {
-                                fail(FileError.NOT_READABLE_ERR);
-                            }
-                        );
-                    }, function () {
-                        fail(FileError.NOT_FOUND_ERR);
-                    }
-                )
-            }
-        );
-    },
-
-    getParent:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-
-
-
-        var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
-        var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
-
-        if (fullPath == storageFolderPer.path) {
-            win(new DirectoryEntry(storageFolderPer.name, storageFolderPer.path));
-            return;
-        } else if (fullPath == storageFolderTem.path) {
-            win(new DirectoryEntry(storageFolderTem.name, storageFolderTem.path));
-            return;
-        }
-        var splitArr = fullPath.split(new RegExp(/\/|\\/g));
-
-        var popItem = splitArr.pop();
-
-        var result = new DirectoryEntry(popItem, fullPath.substr(0, fullPath.length - popItem.length - 1));
-        Windows.Storage.StorageFolder.getFolderFromPathAsync(result.fullPath).done(
-            function () { win(result); },
-            function () { fail(FileError.INVALID_STATE_ERR); }
-        );
-    },
-
-    readAsText:function(win,fail,args) {
-        var enc = args[1];
-
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).done(
-            function (storageFile) {
-                var value = Windows.Storage.Streams.UnicodeEncoding.utf8;
-                if (enc == 'Utf16LE' || enc == 'utf16LE') {
-                    value = Windows.Storage.Streams.UnicodeEncoding.utf16LE;
-                }else if (enc == 'Utf16BE' || enc == 'utf16BE') {
-                    value = Windows.Storage.Streams.UnicodeEncoding.utf16BE;
-                }
-                Windows.Storage.FileIO.readTextAsync(storageFile, value).done(
-                    function (fileContent) {
-                        win(fileContent);
-                    },
-                    function () {
-                        fail(FileError.ENCODING_ERR);
-                    }
-                );
-            }, function () {
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        );
-    },
-
-    readAsDataURL:function(win,fail,args) {
-
-
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(
-            function (storageFile) {
-                Windows.Storage.FileIO.readBufferAsync(storageFile).done(
-                    function (buffer) {
-                        var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
-                        //the method encodeToBase64String will add "77u/" as a prefix, so we should remove it
-                        if(String(strBase64).substr(0,4) == "77u/") {
-                            strBase64 = strBase64.substr(4);
-                        }
-                        var mediaType = storageFile.contentType;
-                        var result = "data:" + mediaType + ";base64," + strBase64;
-                        win(result);
-                    }
-                );
-            }, function () {
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        );
-    },
-
-    getDirectory:function(win,fail,args) {
-        // this.fullPath
-        // path
-        // options
-        var path = args[1];
-        var options = args[2];
-
-        var flag = "";
-        if (options !== null) {
-            flag = new Flags(options.create, options.exclusive);
-        } else {
-            flag = new Flags(false, false);
-        }
-
-        path = String(path).split(" ").join("\ ");
-
-        Windows.Storage.StorageFolder.getFolderFromPathAsync(args[0]).then(
-            function (storageFolder) {
-                if (flag.create === true && flag.exclusive === true) {
-                    storageFolder.createFolderAsync(path, Windows.Storage.CreationCollisionOption.failIfExists).done(
-                        function (storageFolder) {
-                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
-                        }, function () {
-                            fail(FileError.PATH_EXISTS_ERR);
-                        }
-                    );
-                } else if (flag.create === true && flag.exclusive === false) {
-                    storageFolder.createFolderAsync(path, Windows.Storage.CreationCollisionOption.openIfExists).done(
-                        function (storageFolder) {
-                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
-                        }, function () {
-                            fail(FileError.INVALID_MODIFICATION_ERR);
-                        }
-                    );
-                } else if (flag.create === false) {
-                    if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
-                        fail(FileError.ENCODING_ERR);
-                        return;
-                    }
-
-                    storageFolder.getFolderAsync(path).done(
-                        function (storageFolder) {
-                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
-                        }, function () {
-                            fail(FileError.NOT_FOUND_ERR);
-                        }
-                    );
-                }
-            }, function () {
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        );
-    },
-
-    remove:function(win,fail,args) {
-        var fullPath = args[0];
-     
-
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(
-            function (sFile) {
-                Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).done(function (storageFile) {
-                    storageFile.deleteAsync().done(win, function () {
-                        fail(FileError.INVALID_MODIFICATION_ERR);
-
-                    });
-                });
-            },
-            function () {
-                Windows.Storage.StorageFolder.getFolderFromPathAsync(args[0]).then(
-                    function (sFolder) {
-                        var removeEntry = function () {
-                            var storageFolder = null;
-
-                            Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(function (storageFolder) {
-                                //FileSystem root can't be removed!
-                                var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
-                                var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
-                                if (fullPath == storageFolderPer.path || fullPath == storageFolderTem.path) {
-                                    fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
-                                    return;
-                                }
-                                storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
-
-                                    if (fileList.length === 0) {
-                                        storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
-
-                                            if (folderList.length === 0) {
-                                                storageFolder.deleteAsync().done(win, function () {
-                                                    fail(FileError.INVALID_MODIFICATION_ERR);
-
-                                                });
-                                            } else {
-                                                fail(FileError.INVALID_MODIFICATION_ERR);
-                                            }
-                                        });
-                                    } else {
-                                        fail(FileError.INVALID_MODIFICATION_ERR);
-                                    }
-                                });
-
-                            }, function () {
-                                fail(FileError.INVALID_MODIFICATION_ERR);
-
-                            });
-
-
-                        };
-                        removeEntry();
-                    }, function () {
-                        fail(FileError.NOT_FOUND_ERR);
-                    }
-                )
-            }
-        )
-
-    },
-
-    removeRecursively:function(successCallback,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-
-        Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).done(function (storageFolder) {
-        var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
-        var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
-
-        if (storageFolder.path == storageFolderPer.path || storageFolder.path == storageFolderTem.path) {
-            fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
-            return;
-        }
-
-        var removeFolders = function (path) {
-            return new WinJS.Promise(function (complete) {
-                Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(function (storageFolder) {
-                    var fileListPromise = storageFolder.createFileQuery().getFilesAsync();
-                    var filePromiseArr = [];
-
-                    fileListPromise.then(function (fileList) {
-                        if (fileList !== null) {
-                            for (var i = 0; i < fileList.length; i++) {
-                                var filePromise = fileList[i].deleteAsync();
-                                filePromiseArr.push(filePromise);
-                            }
-                        }
-                        WinJS.Promise.join(filePromiseArr).then(function () {
-                            var folderListPromise = storageFolder.createFolderQuery().getFoldersAsync();
-                            folderListPromise.then(function (folderList) {
-                                var folderPromiseArr = [];
-                                if (folderList.length !== 0) {
-                                    for (var j = 0; j < folderList.length; j++) {
-
-                                        folderPromiseArr.push(removeFolders(folderList[j].path));
-                                    }
-                                    WinJS.Promise.join(folderPromiseArr).then(function () {
-                                        storageFolder.deleteAsync().then(complete);
-                                    });
-                                } else {
-                                    storageFolder.deleteAsync().then(complete);
-                                }
-                            }, function () { });
-                       });
-                    }, function () { });
-                });
-            });
-        };
-        removeFolders(storageFolder.path).then(function () {
-            Windows.Storage.StorageFolder.getFolderFromPathAsync(storageFolder.path).then(
-                function () {},
-                function () {
-                    if (typeof successCallback !== 'undefined' && successCallback !== null) { successCallback(); }
-                });
-            });
-        });
-    },
-
-    getFile:function(win,fail,args) {
-        var fullPath = args[0];
-        var path = args[1];
-        var options = args[2];
-
-        var flag = "";
-        if (options != null) {
-            flag = new Flags(options.create, options.exclusive);
-        } else {
-            flag = new Flags(false, false);
-        }
-
-        path = String(path).split(" ").join("\ ");
-
-        Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
-            function (storageFolder) {
-                if (flag.create === true && flag.exclusive === true) {
-                    storageFolder.createFileAsync(path, Windows.Storage.CreationCollisionOption.failIfExists).done(
-                        function (storageFile) {
-                            win(new FileEntry(storageFile.name, storageFile.path));
-                        }, function () {
-                            fail(FileError.PATH_EXISTS_ERR);
-                        }
-                    );
-                } else if (flag.create === true && flag.exclusive === false) {
-                    storageFolder.createFileAsync(path, Windows.Storage.CreationCollisionOption.openIfExists).done(
-                        function (storageFile) {
-                            win(new FileEntry(storageFile.name, storageFile.path));
-                        }, function () {
-                            fail(FileError.INVALID_MODIFICATION_ERR);
-                        }
-                    );
-                } else if (flag.create === false) {
-                    if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
-                        fail(FileError.ENCODING_ERR);
-                        return;
-                    }
-                    storageFolder.getFileAsync(path).done(
-                        function (storageFile) {
-                            win(new FileEntry(storageFile.name, storageFile.path));
-                        }, function () {
-                            fail(FileError.NOT_FOUND_ERR);
-                        }
-                    );
-                }
-            }, function () {
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        );
-    },
-
-    readEntries:function(win,fail,args) { // ["fullPath"]
-
-
-        var result = new Array();
-        var path = args[0];
-        Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(function (storageFolder) {
-            var promiseArr = [];
-            var index = 0;
-            promiseArr[index++] = storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
-                if (fileList !== null) {
-                    for (var i = 0; i < fileList.length; i++) {
-                        result.push(new FileEntry(fileList[i].name, fileList[i].path));
-                    }
-                }
-            });
-            promiseArr[index++] = storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
-                if (folderList !== null) {
-                    for (var j = 0; j < folderList.length; j++) {
-                        result.push(new FileEntry(folderList[j].name, folderList[j].path));
-                    }
-                }
-            });
-            WinJS.Promise.join(promiseArr).then(function () {
-                win(result);
-            });
-
-        }, function () { fail(FileError.NOT_FOUND_ERR); });
-    },
-
-    write:function(win,fail,args) {
-        var text = args[1];
-        // this.position
-
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).done(
-            function (storageFile) {
-                Windows.Storage.FileIO.writeTextAsync(storageFile,text,Windows.Storage.Streams.UnicodeEncoding.utf8).done(
-                    function() {
-                        win(String(text).length);
-                    }, function () {
-                        fail(FileError.INVALID_MODIFICATION_ERR);
-                    }
-                );
-            }, function() {
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        );
-    },
-
-    truncate:function(win,fail,args) { // ["fileName","size"]
-        var fileName = args[0];
-        var size = args[1];
-
-        Windows.Storage.StorageFile.getFileFromPathAsync(fileName).done(function(storageFile){
-            //the current length of the file.
-            var leng = 0;
-
-            storageFile.getBasicPropertiesAsync().then(function (basicProperties) {
-                leng = basicProperties.size;
-                if (Number(size) >= leng) {
-                    win(this.length);
-                    return;
-                }
-                if (Number(size) >= 0) {
-                    Windows.Storage.FileIO.readTextAsync(storageFile, Windows.Storage.Streams.UnicodeEncoding.utf8).then(function (fileContent) {
-                        fileContent = fileContent.substr(0, size);
-                        var fullPath = storageFile.path;
-                        var name = storageFile.name;
-                        var entry = new Entry(true, false, name, fullPath);
-                        var parentPath = "";
-                        do {
-                            var successCallBack = function (entry) {
-                                parentPath = entry.fullPath;
-                            };
-                            entry.getParent(successCallBack, null);
-                        }
-                        while (parentPath === "");
-                        storageFile.deleteAsync().then(function () {
-                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
-                                storageFolder.createFileAsync(name).then(function (newStorageFile) {
-                                    Windows.Storage.FileIO.writeTextAsync(newStorageFile, fileContent).done(function () {
-                                        win(String(fileContent).length);
-                                    }, function () {
-                                        fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
-                                    });
-                                });
-                            });
-                        });
-                    }, function () { fail(FileError.NOT_FOUND_ERR); });
-                }
-            });
-        }, function () { fail(FileError.NOT_FOUND_ERR); });
-    },
-
-    copyTo:function(success,fail,args) { // ["fullPath","parent", "newName"]
-        var srcPath = args[0];
-        var parentFullPath = args[1];
-        var name = args[2];
-
-        //name can't be invalid
-        if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(name)) {
-            fail(FileError.ENCODING_ERR);
-            return;
-        }
-        // copy
-        var copyFiles = "";
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(
-            function (sFile) {
-                copyFiles = function (srcPath, parentPath) {
-                    Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(function (storageFile) {
-                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
-                            storageFile.copyAsync(storageFolder, name, Windows.Storage.NameCollisionOption.failIfExists).then(function (storageFile) {
-
-                                success(new FileEntry(storageFile.name, storageFile.path));
-                            }, function () {
-
-                                fail(FileError.INVALID_MODIFICATION_ERR);
-                            });
-                        }, function () {
-
-                            fail(FileError.NOT_FOUND_ERR);
-                        });
-                    }, function () {
-
-                        fail(FileError.NOT_FOUND_ERR);
-                    });
-                };
-                var copyFinish = function (srcPath, parentPath) {
-                    copyFiles(srcPath, parentPath);
-                };
-                copyFinish(srcPath, parentFullPath);
-            },
-            function () {
-                Windows.Storage.StorageFolder.getFolderFromPathAsync(args[0]).then(
-                    function (sFolder) {
-                        copyFiles = function (srcPath, parentPath) {
-                            return new WinJS.Promise(function (complete) {
-                                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (storageFolder) {
-                                    storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
-                                        var filePromiseArr = [];
-                                        if (fileList) {
-                                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (targetStorageFolder) {
-                                                for (var i = 0; i < fileList.length; i++) {
-                                                    filePromiseArr.push(fileList[i].copyAsync(targetStorageFolder));
-                                                }
-                                                WinJS.Promise.join(filePromiseArr).then(function () {
-                                                    storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
-                                                        var folderPromiseArr = [];
-                                                        if (folderList.length === 0) { complete(); }
-                                                        else {
-
-                                                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolderTarget) {
-                                                                var tempPromiseArr = [];
-                                                                var index = 0;
-                                                                for (var j = 0; j < folderList.length; j++) {
-                                                                    tempPromiseArr[index++] = storageFolderTarget.createFolderAsync(folderList[j].name).then(function (targetFolder) {
-                                                                        folderPromiseArr.push(copyFiles(folderList[j].path, targetFolder.path));
-                                                                    });
-                                                                }
-                                                                WinJS.Promise.join(tempPromiseArr).then(function () {
-                                                                    WinJS.Promise.join(folderPromiseArr).then(complete);
-                                                                });
-                                                            });
-                                                        }
-                                                    });
-                                                });
-                                            });
-                                        }
-                                    });
-                                });
-                            });
-                        };
-                        var copyFinish = function (srcPath, parentPath) {
-                            Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
-                                storageFolder.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists).then(function (newStorageFolder) {
-                                    //can't copy onto itself
-                                    if (srcPath == newStorageFolder.path) {
-                                        fail(FileError.INVALID_MODIFICATION_ERR);
-                                        return;
-                                    }
-                                    //can't copy into itself
-                                    if (srcPath == parentPath) {
-                                        fail(FileError.INVALID_MODIFICATION_ERR);
-                                        return;
-                                    }
-                                    copyFiles(srcPath, newStorageFolder.path).then(function () {
-                                        Windows.Storage.StorageFolder.getFolderFromPathAsync(newStorageFolder.path).done(
-                                            function (storageFolder) {
-                                                success(new DirectoryEntry(storageFolder.name, storageFolder.path));
-                                            },
-                                            function () { fail(FileError.NOT_FOUND_ERR); }
-                                        );
-                                    });
-                                }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
-                            }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
-                        }
-                        copyFinish(srcPath, parentFullPath);
-                    }, function () {
-                        fail(FileError.NOT_FOUND_ERR);
-                    }
-                )
-            }
-        );
-    },
-
-    moveTo:function(success,fail,args) { // ["fullPath","parent", "newName"]
-        var srcPath = args[0];
-        var parentFullPath = args[1];
-        var name = args[2];
-
-
-        //name can't be invalid
-        if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(name)) {
-            fail(FileError.ENCODING_ERR);
-            return;
-        }
-
-        var moveFiles = "";
-        Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(
-            function (sFile) {
-                moveFiles = function (srcPath, parentPath) {
-                    Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(function (storageFile) {
-                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
-                            storageFile.moveAsync(storageFolder, name, Windows.Storage.NameCollisionOption.replaceExisting).then(function () {
-                                success(new FileEntry(name, storageFile.path));
-                            }, function () {
-                                fail(FileError.INVALID_MODIFICATION_ERR);
-                            });
-                        }, function () {
-                            fail(FileError.NOT_FOUND_ERR);
-                        });
-                    }, function () {
-                        fail(FileError.NOT_FOUND_ERR);
-                    });
-                };
-                var moveFinish = function (srcPath, parentPath) {
-                    //can't copy onto itself
-                    if (srcPath == parentPath + "\\" + name) {
-                        fail(FileError.INVALID_MODIFICATION_ERR);
-                        return;
-                    }
-                    moveFiles(srcPath, parentFullPath);
-                }
-                moveFinish(srcPath, parentFullPath);
-            },
-            function () {
-                Windows.Storage.StorageFolder.getFolderFromPathAsync(args[0]).then(
-                    function (sFolder) {
-                        moveFiles = function (srcPath, parentPath) {
-                            return new WinJS.Promise(function (complete) {
-                                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (storageFolder) {
-                                    storageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
-                                        var filePromiseArr = [];
-                                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (dstStorageFolder) {
-                                            if (fileList) {
-                                                for (var i = 0; i < fileList.length; i++) {
-                                                    filePromiseArr.push(fileList[i].moveAsync(dstStorageFolder));
-                                                }
-                                            }
-                                            WinJS.Promise.join(filePromiseArr).then(function () {
-                                                storageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
-                                                    var folderPromiseArr = [];
-                                                    if (folderList.length === 0) {
-                                                        // If failed, we must cancel the deletion of folders & files.So here wo can't delete the folder.
-                                                        complete();
-                                                    }
-                                                    else {
-                                                        Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolderTarget) {
-                                                            var tempPromiseArr = [];
-                                                            var index = 0;
-                                                            for (var j = 0; j < folderList.length; j++) {
-                                                                tempPromiseArr[index++] = storageFolderTarget.createFolderAsync(folderList[j].name).then(function (targetFolder) {
-                                                                    folderPromiseArr.push(moveFiles(folderList[j].path, targetFolder.path));
-                                                                });
-                                                            }
-                                                            WinJS.Promise.join(tempPromiseArr).then(function () {
-                                                                WinJS.Promise.join(folderPromiseArr).then(complete);
-                                                            });
-                                                        });
-                                                    }
-                                                });
-                                            }, function () { });
-                                        });
-                                    });
-                                });
-                            });
-                        };
-                        var moveFinish = function (srcPath, parentPath) {
-                            Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (originFolder) {
-                                Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) {
-                                    storageFolder.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists).then(function (newStorageFolder) {
-                                        //can't move onto directory that is not empty
-                                        newStorageFolder.createFileQuery().getFilesAsync().then(function (fileList) {
-                                            newStorageFolder.createFolderQuery().getFoldersAsync().then(function (folderList) {
-                                                if (fileList.length !== 0 || folderList.length !== 0) {
-                                                    fail(FileError.INVALID_MODIFICATION_ERR);
-                                                    return;
-                                                }
-                                                //can't copy onto itself
-                                                if (srcPath == newStorageFolder.path) {
-                                                    fail(FileError.INVALID_MODIFICATION_ERR);
-                                                    return;
-                                                }
-                                                //can't copy into itself
-                                                if (srcPath == parentPath) {
-                                                    fail(FileError.INVALID_MODIFICATION_ERR);
-                                                    return;
-                                                }
-                                                moveFiles(srcPath, newStorageFolder.path).then(function () {
-                                                    var successCallback = function () { success(new DirectoryEntry(name, newStorageFolder.path)); }
-                                                    new DirectoryEntry(originFolder.name, originFolder.path).removeRecursively(successCallback, fail);
-
-                                                }, function () { console.log("error!"); });
-                                            });
-                                        });
-                                    }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
-                                }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
-                            }, function () { fail(FileError.INVALID_MODIFICATION_ERR); });
-
-                        }
-                        moveFinish(srcPath, parentFullPath);
-                    }, function () {
-                        fail(FileError.NOT_FOUND_ERR);
-                    }
-                )
-            }
-        );
-    },
-
-    tempFileSystem:null,
-    persistentFileSystem:null,
-    requestFileSystem:function(win,fail,args) {
-        var type = args[0];
-        var size = args[1];
-
-        var filePath = "";
-        var result = null;
-        var fsTypeName = "";
-
-        switch (type) {
-            case LocalFileSystem.TEMPORARY:
-                filePath = Windows.Storage.ApplicationData.current.temporaryFolder.path;
-                fsTypeName = "temporary";
-                break;
-            case LocalFileSystem.PERSISTENT:
-                filePath = Windows.Storage.ApplicationData.current.localFolder.path;
-                fsTypeName = "persistent";
-                break;
-        }
-
-        var MAX_SIZE = 10000000000;
-        if (size > MAX_SIZE) {
-            fail(FileError.QUOTA_EXCEEDED_ERR);
-            return;
-        }
-
-        var fileSystem = new FileSystem(fsTypeName, new DirectoryEntry(fsTypeName, filePath));
-        result = fileSystem;
-        win(result);
-    },
-
-    resolveLocalFileSystemURI:function(success,fail,args) {
-        var uri = args[0];
-
-        var path = uri;
-        path = path.split(" ").join("\ ");
-
-        // support for file name with parameters
-        if (/\?/g.test(path)) {
-            path = String(path).split("\?")[0];
-        }
-
-        // support for encodeURI
-        if (/\%5/g.test(path)) {
-            path = decodeURI(path);
-        }
-
-        // support for special path start with file:///
-        if (path.substr(0, 8) == "file:///") {
-            path = Windows.Storage.ApplicationData.current.localFolder.path + "\\" + String(path).substr(8).split("/").join("\\");
-            Windows.Storage.StorageFile.getFileFromPathAsync(path).then(
-                function (storageFile) {
-                    success(new FileEntry(storageFile.name, storageFile.path));
-                }, function () {
-                    Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
-                        function (storageFolder) {
-                            success(new DirectoryEntry(storageFolder.name, storageFolder.path));
-                        }, function () {
-                            fail(FileError.NOT_FOUND_ERR);
-                        }
-                    );
-                }
-            );
-        } else {
-            Windows.Storage.StorageFile.getFileFromPathAsync(path).then(
-                function (storageFile) {
-                    success(new FileEntry(storageFile.name, storageFile.path));
-                }, function () {
-                    Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
-                        function (storageFolder) {
-                            success(new DirectoryEntry(storageFolder.name, storageFolder.path));
-                        }, function () {
-                            fail(FileError.ENCODING_ERR);
-                        }
-                    );
-                }
-            );
-        }
-    }
-
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a43bf481/lib/windows8/plugin/windows8/geolocation.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/geolocation.js b/lib/windows8/plugin/windows8/geolocation.js
index 503e049..311d371 100644
--- a/lib/windows8/plugin/windows8/geolocation.js
+++ b/lib/windows8/plugin/windows8/geolocation.js
@@ -19,7 +19,7 @@ module.exports = { // Merges with common
                 // Win8 JS API coordinate Object
                 win(geoposition.coordinate);
             }, function() {
-                var e = new Object();
+                var e = {};
 
                 switch (geolocator.locationStatus) {
                     case Windows.Devices.Geolocation.PositionStatus.ready:


Mime
View raw message