You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/08/15 00:31:20 UTC

[1/7] git commit: [Windows8] added support

Updated Branches:
  refs/heads/dev 6095667db -> 59d77af6e (forced update)


[Windows8] added support


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

Branch: refs/heads/dev
Commit: d4a9b9e2bee297fa021ba6b75515101404a86b85
Parents: 698d7f6
Author: purplecabbage <pu...@gmail.com>
Authored: Mon Jul 29 17:57:49 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Mon Jul 29 17:57:49 2013 -0700

----------------------------------------------------------------------
 plugin.xml                |   7 +
 src/windows8/FileProxy.js | 845 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 852 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d4a9b9e2/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index fb74905..692bce3 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -181,4 +181,11 @@
         </js-module>
     </platform>
 
+    <!-- windows8 -->
+    <platform name="windows8">
+        <js-module src="src/windows8/FileProxy.js" name="FileProxy">
+            <merges target="" />
+        </js-module>
+    </platform>
+
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d4a9b9e2/src/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/FileProxy.js b/src/windows8/FileProxy.js
new file mode 100644
index 0000000..6da9dd0
--- /dev/null
+++ b/src/windows8/FileProxy.js
@@ -0,0 +1,845 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova');
+var Entry = require('./Entry'),
+    File = require('./File'),
+    FileEntry = require('./FileEntry'),
+    FileError = require('./FileError'),
+    DirectoryEntry = require('./DirectoryEntry'),
+    Flags = require('./Flags'),
+    FileSystem = require('./FileSystem'),
+    LocalFileSystem = require('./LocalFileSystem');
+
+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 && fail(FileError.NOT_READABLE_ERR);
+                    }
+                );
+            }, function () {
+                fail && fail(FileError.NOT_FOUND_ERR);
+            }
+        );
+    },
+
+    getMetadata:function(success,fail,args) {
+        var fullPath = args[0];
+
+        var dealFile = function (sFile) {
+            Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).then(
+                function (storageFile) {
+                    return storageFile.getBasicPropertiesAsync();
+                },
+                function () {
+                    fail && fail(FileError.NOT_READABLE_ERR);
+                }
+            // get the basic properties of the file.
+            ).then(
+                function (basicProperties) {
+                    success(basicProperties.dateModified);
+                },
+                function () {
+                    fail && fail(FileError.NOT_READABLE_ERR);
+                }
+            );
+        };
+
+        var dealFolder = function (sFolder) {
+            Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+                function (storageFolder) {
+                    return storageFolder.getBasicPropertiesAsync();
+                },
+                function () {
+                    fail && fail(FileError.NOT_READABLE_ERR);
+                }
+            // get the basic properties of the folder.
+            ).then(
+                function (basicProperties) {
+                    success(basicProperties.dateModified);
+                },
+                function () {
+                    fail && fail(FileError.NOT_FOUND_ERR);
+                }
+            );
+        };
+
+        Windows.Storage.StorageFile.getFileFromPathAsync(fullPath).then(
+            // the path is file.
+            function (sFile) {
+                dealFile(sFile);
+            },
+            // the path is folder
+            function () {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+                    function (sFolder) {
+                        dealFolder(sFolder);
+                    }, function () {
+                        fail && 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 && 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 && fail(FileError.ENCODING_ERR);
+                    }
+                );
+            }, function () {
+                fail && 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 && 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);
+        }
+
+        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 && 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 && fail(FileError.INVALID_MODIFICATION_ERR);
+                        }
+                    );
+                } else if (flag.create === false) {
+                    if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
+                        fail && fail(FileError.ENCODING_ERR);
+                        return;
+                    }
+
+                    storageFolder.getFolderAsync(path).done(
+                        function (storageFolder) {
+                            win(new DirectoryEntry(storageFolder.name, storageFolder.path));
+                        }, function () {
+                            fail && fail(FileError.NOT_FOUND_ERR);
+                        }
+                    );
+                }
+            }, function () {
+                fail && 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 && fail(FileError.INVALID_MODIFICATION_ERR);
+
+                    });
+                });
+            },
+            function () {
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).then(
+                    function (sFolder) {
+                        var removeEntry = function () {
+                            var storageFolderTop = 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 && fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+                                        return;
+                                    }
+                                    storageFolderTop = storageFolder;
+                                    return storageFolder.createFileQuery().getFilesAsync();
+                                }, function () {
+                                    fail && fail(FileError.INVALID_MODIFICATION_ERR);
+
+                                }
+                            // check sub-files.
+                            ).then(function (fileList) {
+                                if (fileList) {
+                                    if (fileList.length === 0) {
+                                        return storageFolderTop.createFolderQuery().getFoldersAsync();
+                                    } else {
+                                        fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                                    }
+                                }
+                            // check sub-folders.
+                            }).then(function (folderList) {
+                                if (folderList) {
+                                    if (folderList.length === 0) {
+                                        storageFolderTop.deleteAsync().done(win, function () {
+                                            fail && fail(FileError.INVALID_MODIFICATION_ERR);
+
+                                        });
+                                    } else {
+                                        fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                                    }
+                                }
+
+                            });
+                        };
+                        removeEntry();
+                    }, function () {
+                        fail && 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 && fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+            return;
+        }
+
+        var removeFolders = function (path) {
+            return new WinJS.Promise(function (complete) {
+                var filePromiseArr = [];
+                var storageFolderTop = null;
+                Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
+                    function (storageFolder) {
+                        var fileListPromise = storageFolder.createFileQuery().getFilesAsync();
+
+                        storageFolderTop = storageFolder;
+                        return fileListPromise;
+                    }
+                // remove all the files directly under the folder.
+                ).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 = storageFolderTop.createFolderQuery().getFoldersAsync();
+                        return folderListPromise;
+                    // remove empty folders.
+                    }).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 () {
+                                storageFolderTop.deleteAsync().then(complete);
+                            });
+                        } else {
+                            storageFolderTop.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);
+        }
+
+        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 && 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 && fail(FileError.INVALID_MODIFICATION_ERR);
+                        }
+                    );
+                } else if (flag.create === false) {
+                    if (/\?|\\|\*|\||\"|<|>|\:|\//g.test(path)) {
+                        fail && fail(FileError.ENCODING_ERR);
+                        return;
+                    }
+                    storageFolder.getFileAsync(path).done(
+                        function (storageFile) {
+                            win(new FileEntry(storageFile.name, storageFile.path));
+                        }, function () {
+                            fail && fail(FileError.NOT_FOUND_ERR);
+                        }
+                    );
+                }
+            }, function () {
+                fail && 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 && 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 && fail(FileError.INVALID_MODIFICATION_ERR);
+                    }
+                );
+            }, function() {
+                fail && 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 = "";
+                        var successCallBack = function (entry) {
+                            parentPath = entry.fullPath;
+                            storageFile.deleteAsync().then(function () {
+                                return 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 && fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+                                    });
+                                });
+                            });
+                        };
+                        entry.getParent(successCallBack, null);
+                    }, function () { fail && fail(FileError.NOT_FOUND_ERR); });
+                }
+            });
+        }, function () { fail && 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 && fail(FileError.ENCODING_ERR);
+            return;
+        }
+        // copy
+        var copyFiles = "";
+        Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(
+            function (sFile) {
+                copyFiles = function (srcPath, parentPath) {
+                    var storageFileTop = null;
+                    Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(function (storageFile) {
+                        storageFileTop = storageFile;
+                        return Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath);
+                    }, function () {
+
+                        fail && fail(FileError.NOT_FOUND_ERR);
+                    }).then(function (storageFolder) {
+                        storageFileTop.copyAsync(storageFolder, name, Windows.Storage.NameCollisionOption.failIfExists).then(function (storageFile) {
+
+                            success(new FileEntry(storageFile.name, storageFile.path));
+                        }, function () {
+
+                            fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                        });
+                    }, function () {
+
+                        fail && 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) {
+                            var coreCopy = function (storageFolderTop, complete) {
+                                storageFolderTop.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);
+                                            });
+                                        });
+                                    }
+                                });
+                            };
+
+                            return new WinJS.Promise(function (complete) {
+                                var storageFolderTop = null;
+                                var filePromiseArr = [];
+                                var fileListTop = null;
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (storageFolder) {
+                                    storageFolderTop = storageFolder;
+                                    return storageFolder.createFileQuery().getFilesAsync();
+                                }).then(function (fileList) {
+                                    fileListTop = fileList;
+                                    if (fileList) {
+                                        return Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath);
+                                    }
+                                }).then(function (targetStorageFolder) {
+                                    for (var i = 0; i < fileListTop.length; i++) {
+                                        filePromiseArr.push(fileListTop[i].copyAsync(targetStorageFolder));
+                                    }
+                                    WinJS.Promise.join(filePromiseArr).then(function () {
+                                        coreCopy(storageFolderTop, 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 && fail(FileError.INVALID_MODIFICATION_ERR);
+                                        return;
+                                    }
+                                    //can't copy into itself
+                                    if (srcPath == parentPath) {
+                                        fail && 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 && fail(FileError.NOT_FOUND_ERR); }
+                                        );
+                                    });
+                                }, function () { fail && fail(FileError.INVALID_MODIFICATION_ERR); });
+                            }, function () { fail && fail(FileError.INVALID_MODIFICATION_ERR); });
+                        };
+                        copyFinish(srcPath, parentFullPath);
+                    }, function () {
+                        fail && 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 && fail(FileError.ENCODING_ERR);
+            return;
+        }
+
+        var moveFiles = "";
+        Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(
+            function (sFile) {
+                moveFiles = function (srcPath, parentPath) {
+                    var storageFileTop = null;
+                    Windows.Storage.StorageFile.getFileFromPathAsync(srcPath).then(function (storageFile) {
+                        storageFileTop = storageFile;
+                        return Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath);
+                    }, function () {
+                        fail && fail(FileError.NOT_FOUND_ERR);
+                    }).then(function (storageFolder) {
+                        storageFileTop.moveAsync(storageFolder, name, Windows.Storage.NameCollisionOption.replaceExisting).then(function () {
+                            success(new FileEntry(name, storageFileTop.path));
+                        }, function () {
+                            fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                        });
+                    }, function () {
+                        fail && fail(FileError.NOT_FOUND_ERR);
+                    });
+                };
+                var moveFinish = function (srcPath, parentPath) {
+                    //can't copy onto itself
+                    if (srcPath == parentPath + "\\" + name) {
+                        fail && 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) {
+                            var coreMove = function (storageFolderTop, complete) {
+                                storageFolderTop.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);
+                                            });
+                                        });
+                                    }
+                                });
+                            };
+                            return new WinJS.Promise(function (complete) {
+                                var storageFolderTop = null;
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (storageFolder) {
+                                    storageFolderTop = storageFolder;
+                                    return 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 () {
+                                            coreMove(storageFolderTop, complete);
+                                        }, function () { });
+                                    });
+                                });
+                            });
+                        };
+                        var moveFinish = function (srcPath, parentPath) {
+                            var originFolderTop = null;
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(srcPath).then(function (originFolder) {
+                                originFolderTop = originFolder;
+                                return Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath);
+                            }, function () {
+                                fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                            }).then(function (storageFolder) {
+                                return storageFolder.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists);
+                            }, function () {
+                                fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                            }).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 && fail(FileError.INVALID_MODIFICATION_ERR);
+                                            return;
+                                        }
+                                        //can't copy onto itself
+                                        if (srcPath == newStorageFolder.path) {
+                                            fail && fail(FileError.INVALID_MODIFICATION_ERR);
+                                            return;
+                                        }
+                                        //can't copy into itself
+                                        if (srcPath == parentPath) {
+                                            fail && 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(originFolderTop.name, originFolderTop.path).removeRecursively(successCallback, fail);
+
+                                        }, function () { console.log("error!"); });
+                                    });
+                                });
+                            }, function () { fail && fail(FileError.INVALID_MODIFICATION_ERR); });
+
+                        };
+                        moveFinish(srcPath, parentFullPath);
+                    }, function () {
+                        fail && 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 && 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;
+
+        // 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 && 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 && fail(FileError.ENCODING_ERR);
+                        }
+                    );
+                }
+            );
+        }
+    }
+
+};
+
+require("cordova/commandProxy").add("File",module.exports);


[2/7] git commit: updating plugin.xml with registry data

Posted by st...@apache.org.
updating plugin.xml with registry data


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

Branch: refs/heads/dev
Commit: 1a38081abfb9206124ecf30948b24d15096e2e35
Parents: d4a9b9e
Author: Anis Kadri <an...@apache.org>
Authored: Tue Jul 30 15:32:13 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Tue Jul 30 15:32:13 2013 -0700

----------------------------------------------------------------------
 plugin.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/1a38081a/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 692bce3..4ab3eeb 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -4,6 +4,9 @@
            id="org.apache.cordova.core.file"
       version="0.1.0">
     <name>File</name>
+    <description>Cordova File Plugin</description>
+    <license>Apache</license>
+    <keywords>cordova,file</keywords>
 
     <js-module src="www/DirectoryEntry.js" name="DirectoryEntry">
         <clobbers target="window.DirectoryEntry" />


[3/7] git commit: [license] adding apache license file

Posted by st...@apache.org.
[license] adding apache license file


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

Branch: refs/heads/dev
Commit: 1a63a76c7daf676e9d38af9a6db2ead6e4d3c9f0
Parents: 1a38081
Author: Hardeep Shoker <sh...@gmail.com>
Authored: Tue Aug 6 14:42:09 2013 -0700
Committer: Hardeep Shoker <sh...@gmail.com>
Committed: Tue Aug 6 14:42:09 2013 -0700

----------------------------------------------------------------------
 LICENSE | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 202 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/1a63a76c/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7a4a3ea
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file


[7/7] git commit: [CB-4417] Move cordova-plugin-file to its own Java package.

Posted by st...@apache.org.
[CB-4417] Move cordova-plugin-file to its own Java package.


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

Branch: refs/heads/dev
Commit: 59d77af6e389e4d485e95b72752cea52a5f20c88
Parents: c76aaed
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Jul 31 19:57:24 2013 -0400
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Aug 14 15:31:02 2013 -0700

----------------------------------------------------------------------
 plugin.xml                                      | 14 +++++++-------
 src/android/EncodingException.java              |  2 +-
 src/android/FileExistsException.java            |  2 +-
 src/android/FileUtils.java                      |  2 +-
 src/android/InvalidModificationException.java   |  2 +-
 src/android/NoModificationAllowedException.java |  2 +-
 src/android/TypeMismatchException.java          |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 3be0fbd..da931aa 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -81,7 +81,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
             <feature name="File" >
-                <param name="android-package" value="org.apache.cordova.core.FileUtils"/>
+                <param name="android-package" value="org.apache.cordova.file.FileUtils"/>
             </feature>
         </config-file>
 
@@ -89,12 +89,12 @@ xmlns:android="http://schemas.android.com/apk/res/android"
             <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
         </config-file>
 
-        <source-file src="src/android/EncodingException.java" target-dir="src/org/apache/cordova/core" />
-        <source-file src="src/android/FileExistsException.java" target-dir="src/org/apache/cordova/core" />
-        <source-file src="src/android/InvalidModificationException.java" target-dir="src/org/apache/cordova/core" />
-        <source-file src="src/android/NoModificationAllowedException.java" target-dir="src/org/apache/cordova/core" />
-        <source-file src="src/android/TypeMismatchException.java" target-dir="src/org/apache/cordova/core" />
-        <source-file src="src/android/FileUtils.java" target-dir="src/org/apache/cordova/core" />
+        <source-file src="src/android/EncodingException.java" target-dir="src/org/apache/cordova/file" />
+        <source-file src="src/android/FileExistsException.java" target-dir="src/org/apache/cordova/file" />
+        <source-file src="src/android/InvalidModificationException.java" target-dir="src/org/apache/cordova/file" />
+        <source-file src="src/android/NoModificationAllowedException.java" target-dir="src/org/apache/cordova/file" />
+        <source-file src="src/android/TypeMismatchException.java" target-dir="src/org/apache/cordova/file" />
+        <source-file src="src/android/FileUtils.java" target-dir="src/org/apache/cordova/file" />
     </platform>
     
     <!-- ios -->

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/src/android/EncodingException.java
----------------------------------------------------------------------
diff --git a/src/android/EncodingException.java b/src/android/EncodingException.java
index 430e8c8..a32e18e 100644
--- a/src/android/EncodingException.java
+++ b/src/android/EncodingException.java
@@ -17,7 +17,7 @@
        under the License.
 */
 
-package org.apache.cordova.core;
+package org.apache.cordova.file;
 
 public class EncodingException extends Exception {
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/src/android/FileExistsException.java
----------------------------------------------------------------------
diff --git a/src/android/FileExistsException.java b/src/android/FileExistsException.java
index 9549097..18aa7ea 100644
--- a/src/android/FileExistsException.java
+++ b/src/android/FileExistsException.java
@@ -17,7 +17,7 @@
        under the License.
 */
 
-package org.apache.cordova.core;
+package org.apache.cordova.file;
 
 public class FileExistsException extends Exception {
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index 8c8f513..2da2868 100755
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -16,7 +16,7 @@
        specific language governing permissions and limitations
        under the License.
  */
-package org.apache.cordova.core;
+package org.apache.cordova.file;
 
 import android.database.Cursor;
 import android.net.Uri;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/src/android/InvalidModificationException.java
----------------------------------------------------------------------
diff --git a/src/android/InvalidModificationException.java b/src/android/InvalidModificationException.java
index 51886ed..aebab4d 100644
--- a/src/android/InvalidModificationException.java
+++ b/src/android/InvalidModificationException.java
@@ -18,7 +18,7 @@
 */
 
 
-package org.apache.cordova.core;
+package org.apache.cordova.file;
 
 public class InvalidModificationException extends Exception {
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/src/android/NoModificationAllowedException.java
----------------------------------------------------------------------
diff --git a/src/android/NoModificationAllowedException.java b/src/android/NoModificationAllowedException.java
index 771d1d5..8cae115 100644
--- a/src/android/NoModificationAllowedException.java
+++ b/src/android/NoModificationAllowedException.java
@@ -17,7 +17,7 @@
        under the License.
 */
 
-package org.apache.cordova.core;
+package org.apache.cordova.file;
 
 public class NoModificationAllowedException extends Exception {
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/59d77af6/src/android/TypeMismatchException.java
----------------------------------------------------------------------
diff --git a/src/android/TypeMismatchException.java b/src/android/TypeMismatchException.java
index 19f7b5d..0ea5993 100644
--- a/src/android/TypeMismatchException.java
+++ b/src/android/TypeMismatchException.java
@@ -18,7 +18,7 @@
 */
 
 
-package org.apache.cordova.core;
+package org.apache.cordova.file;
 
 public class TypeMismatchException extends Exception {
 


[4/7] git commit: [plugin.xml] standardizing license + meta

Posted by st...@apache.org.
[plugin.xml] standardizing license + meta


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

Branch: refs/heads/dev
Commit: 09255e638ca3ff7fdb505cd555e2e986375b6f32
Parents: 1a63a76
Author: Hardeep Shoker <sh...@gmail.com>
Authored: Tue Aug 6 14:52:52 2013 -0700
Committer: Hardeep Shoker <sh...@gmail.com>
Committed: Tue Aug 6 14:52:52 2013 -0700

----------------------------------------------------------------------
 plugin.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/09255e63/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 4ab3eeb..c96a4af 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -5,7 +5,7 @@
       version="0.1.0">
     <name>File</name>
     <description>Cordova File Plugin</description>
-    <license>Apache</license>
+    <license>Apache 2.0</license>
     <keywords>cordova,file</keywords>
 
     <js-module src="www/DirectoryEntry.js" name="DirectoryEntry">


[5/7] git commit: [plugin.xml] adding android namespace

Posted by st...@apache.org.
[plugin.xml] adding android namespace


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

Branch: refs/heads/dev
Commit: d3c7e179d975f37d78de4629d22653b150494e23
Parents: 09255e6
Author: Hardeep Shoker <sh...@gmail.com>
Authored: Tue Aug 6 15:17:27 2013 -0700
Committer: Hardeep Shoker <sh...@gmail.com>
Committed: Tue Aug 6 15:17:27 2013 -0700

----------------------------------------------------------------------
 plugin.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d3c7e179/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index c96a4af..cc791bd 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
+xmlns:android="http://schemas.android.com/apk/res/android"
            id="org.apache.cordova.core.file"
       version="0.1.0">
     <name>File</name>


[6/7] git commit: updated namespace, name tag and readme

Posted by st...@apache.org.
updated namespace, name tag and readme


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

Branch: refs/heads/dev
Commit: c76aaeddccc49132f1d6eec1aa6f348f5ee40d92
Parents: d3c7e17
Author: Steven Gill <st...@gmail.com>
Authored: Wed Jul 24 12:00:30 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Aug 14 15:31:01 2013 -0700

----------------------------------------------------------------------
 README.md  | 2 +-
 plugin.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/c76aaedd/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 673b6e5..260c816 100644
--- a/README.md
+++ b/README.md
@@ -2,4 +2,4 @@ cordova-plugin-file
 --------------------------
 To install this plugin, follow the [Command-line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface).
 
-If you are not using the Cordova Command-line Interface, follow [Using Plugman to Manage Plugins](http://cordova.apache.org/docs/en/edge/guide_plugin_ref_plugman.md.html).
+If you are not using the Cordova Command-line Interface, follow [Using Plugman to Manage Plugins](http://cordova.apache.org/docs/en/edge/plugin_ref_plugman.md.html).

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/c76aaedd/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index cc791bd..3be0fbd 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
 xmlns:android="http://schemas.android.com/apk/res/android"
            id="org.apache.cordova.core.file"
       version="0.1.0">