You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2012/06/07 22:40:43 UTC
[5/48] js commit: Cleaning up comments
Cleaning up comments
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/54f3ed93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/54f3ed93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/54f3ed93
Branch: refs/heads/master
Commit: 54f3ed9395fd7d4132903157f2e8a81d0bc01247
Parents: e5b9cf2
Author: Tim Kim <ti...@nitobi.com>
Authored: Thu May 31 14:38:19 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Thu Jun 7 13:40:24 2012 -0700
----------------------------------------------------------------------
lib/playbook/plugin/playbook/DirectoryReader.js | 2 +-
lib/playbook/plugin/playbook/Entry.js | 18 +++++++++-----
lib/playbook/plugin/playbook/FileEntry.js | 2 +-
lib/playbook/plugin/playbook/FileReader.js | 4 +-
lib/playbook/plugin/playbook/FileWriter.js | 8 +-----
.../plugin/playbook/resolveLocalFileSystemURI.js | 3 +-
6 files changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/54f3ed93/lib/playbook/plugin/playbook/DirectoryReader.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/DirectoryReader.js b/lib/playbook/plugin/playbook/DirectoryReader.js
index 9ef8233..e45cdc2 100644
--- a/lib/playbook/plugin/playbook/DirectoryReader.js
+++ b/lib/playbook/plugin/playbook/DirectoryReader.js
@@ -37,7 +37,7 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
};
var theEntries = [];
-
+ // Entry object is borked - unable to instantiate a new Entry object so just create one
var anEntry = function(isDirectory, name, fullPath){
this.isDirectory = (isDirectory ? true : false),
this.isFile = (isDirectory ? false : true),
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/54f3ed93/lib/playbook/plugin/playbook/Entry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/Entry.js b/lib/playbook/plugin/playbook/Entry.js
index d3f9819..f2700ef 100644
--- a/lib/playbook/plugin/playbook/Entry.js
+++ b/lib/playbook/plugin/playbook/Entry.js
@@ -80,7 +80,7 @@ module.exports = {
}
};
- // Entry object is borked for some reason - unable to instantiate a new Entry object so just create one
+ // Entry object is borked - unable to instantiate a new Entry object so just create one
var theEntry = {};
var dstPath = parent.fullPath + '/' + name;
if(this.isFile){
@@ -94,8 +94,8 @@ module.exports = {
theEntry.isDirectory = false;
theEntry.isFile = true;
success(theEntry);
-
}else if(blackberry.io.dir.exists(dstPath)){
+ // destination path is a directory
fail(FileError.INVALID_MODIFICATION_ERR);
}else{
blackberry.io.file.copy(srcPath,dstPath);
@@ -108,12 +108,13 @@ module.exports = {
success(theEntry);
}
}else{
- console.log('file onto itself');
+ // file onto itself
fail(FileError.INVALID_MODIFICATION_ERR);
}
}else{
if(srcPath != dstPath){
if(blackberry.io.file.exists(dstPath) || srcPath == parent.fullPath){
+ // destination path is either a file path or
fail(FileError.INVALID_MODIFICATION_ERR);
}else{
if(!blackberry.io.dir.exists(dstPath)){
@@ -139,12 +140,13 @@ module.exports = {
theEntry.isFile = false;
success(theEntry);
}else{
+ // destination directory not empty
fail(FileError.INVALID_MODIFICATION_ERR);
}
}
}
}else{
- console.log('directory onto itself');
+ // directory onto itself
fail(FileError.INVALID_MODIFICATION_ERR);
}
}
@@ -185,7 +187,7 @@ module.exports = {
}
};
- // Entry object is borked for some reason - unable to instantiate a new Entry object so just create one
+ // Entry object is borked - unable to instantiate a new Entry object so just create one
var theEntry = {};
var dstPath = parent.fullPath + '/' + name;
if(this.isFile){
@@ -200,6 +202,7 @@ module.exports = {
theEntry.isFile = true;
success(theEntry);
}else{
+ // destination directory doesn't exist
fail(FileError.NOT_FOUND_ERR);
}
@@ -213,12 +216,13 @@ module.exports = {
success(theEntry);
}
}else{
- console.log('file onto itself');
+ // file onto itself
fail(FileError.INVALID_MODIFICATION_ERR);
}
}else{
if(srcPath != dstPath){
if(dstPath.indexOf(srcPath)>=0 || blackberry.io.file.exists(dstPath)){
+ // copying directory into child or is file path
fail(FileError.INVALID_MODIFICATION_ERR);
}else{
recursiveCopy(srcPath, dstPath);
@@ -230,7 +234,7 @@ module.exports = {
success(theEntry);
}
}else{
- console.log('directory onto itself');
+ // directory onto itself
fail(FileError.INVALID_MODIFICATION_ERR);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/54f3ed93/lib/playbook/plugin/playbook/FileEntry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/FileEntry.js b/lib/playbook/plugin/playbook/FileEntry.js
index 42bedb8..65a2607 100644
--- a/lib/playbook/plugin/playbook/FileEntry.js
+++ b/lib/playbook/plugin/playbook/FileEntry.js
@@ -42,7 +42,7 @@ module.exports = {
errorCallback(new FileError(code));
};
- if(blackberry.io.file.exists(this.fullPath)){
+ if(blackberry.io.file.exists(this.fullPath)){
var theFileProperties = blackberry.io.file.getFileProperties(this.fullPath);
var theFile = {};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/54f3ed93/lib/playbook/plugin/playbook/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/FileReader.js b/lib/playbook/plugin/playbook/FileReader.js
index 564f717..1f75998 100644
--- a/lib/playbook/plugin/playbook/FileReader.js
+++ b/lib/playbook/plugin/playbook/FileReader.js
@@ -108,7 +108,7 @@ FileReader.prototype.readAsText = function(file, encoding) {
}
}
}
- // setting asynch to off - worry about making this all callbacks later
+ // setting asynch to off
blackberry.io.file.readFile(this.fileName, getFileContents, false);
}else{
@@ -190,7 +190,7 @@ FileReader.prototype.readAsDataURL = function(file) {
}
}
}
- // setting asynch to off - worry about making this all callbacks later
+ // setting asynch to off
blackberry.io.file.readFile(this.fileName, getFileContents, false);
}else{
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/54f3ed93/lib/playbook/plugin/playbook/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/FileWriter.js b/lib/playbook/plugin/playbook/FileWriter.js
index 954e8e7..146eb11 100644
--- a/lib/playbook/plugin/playbook/FileWriter.js
+++ b/lib/playbook/plugin/playbook/FileWriter.js
@@ -83,9 +83,6 @@ FileWriter.prototype.write = function(text) {
me.onwritestart(new ProgressEvent("writestart", {"target":me}));
}
- // Write file
- // TODO: Need to think about how to make this asynch and add try/catch
-
if (typeof me.onwrite === "function") {
me.onwrite(new ProgressEvent("write", {"target":me}));
}
@@ -122,7 +119,7 @@ FileWriter.prototype.write = function(text) {
me.length = me.position;
}
- // setting asynch to off - worry about making this all callbacks later
+ // setting asynch to off
blackberry.io.file.readFile(this.fileName, getFileContents, false);
}else{
@@ -196,9 +193,6 @@ FileWriter.prototype.truncate = function(size) {
me.onwritestart(new ProgressEvent("writestart", {"target":this}));
}
- // Write file
- // TODO: Need to think about how to make this asynch and add try/catch
-
if (typeof me.onwrite === "function") {
me.onwrite(new ProgressEvent("write", {"target":me}));
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/54f3ed93/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js b/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
index 75b3f7d..b52bcf3 100644
--- a/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
+++ b/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js
@@ -36,8 +36,9 @@ module.exports = function(uri, successCallback, errorCallback) {
fail(FileError.NOT_FOUND_ERR);
}
};
+
+ // Entry object is borked - unable to instantiate a new Entry object so just create one
var theEntry = {};
- console.log('the uri: ' + uri);
if(blackberry.io.dir.exists(uri)){
theEntry.isDirectory = true;
theEntry.name = uri.split('/').pop();