cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [34/51] [abbrv] git commit: correctly resolve file/directories using fs provided methods
Date Wed, 27 Nov 2013 22:27:33 GMT
correctly resolve file/directories using fs provided methods


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/2d7f08df
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/2d7f08df
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/2d7f08df

Branch: refs/heads/fireos
Commit: 2d7f08dfd408dc3f7dc47526b673a9e07fab1afd
Parents: 5877dd2
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Tue Nov 26 12:13:09 2013 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Tue Nov 26 12:13:09 2013 -0800

----------------------------------------------------------------------
 src/metadata/windows8_parser.js | 11 ++++++-----
 src/metadata/wp7_parser.js      |  9 +++++----
 src/metadata/wp8_parser.js      |  9 +++++----
 3 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/2d7f08df/src/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/windows8_parser.js b/src/metadata/windows8_parser.js
index 751f54d..bcbee53 100644
--- a/src/metadata/windows8_parser.js
+++ b/src/metadata/windows8_parser.js
@@ -242,25 +242,26 @@ module.exports.prototype = {
         // save file
         fs.writeFileSync(this.jsproj_path, jsproj_xml.write({indent:4}), 'utf-8');
     },
-    // Returns an array of all the files in the given directory with reletive paths
+    // Returns an array of all the files in the given directory with relative paths
     // - name     : the name of the top level directory (i.e all files will start with this
in their path)
-    // - path     : the directory whos contents will be listed under 'name' directory
+    // - dir     : the directory whos contents will be listed under 'name' directory
     folder_contents:function(name, dir) {
         var results = [];
         var folder_dir = fs.readdirSync(dir);
         for(item in folder_dir) {
             var stat = fs.statSync(path.join(dir, folder_dir[item]));
-            // means its a folder?
-            if(stat.size == 0) {
+
+            if(stat.isDirectory()) {
                 var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
                 //Add all subfolder item paths
                 for(sub_item in sub_dir) {
                     results.push(sub_dir[sub_item]);
                 }
             }
-            else {
+            else if(stat.isFile()) {
                 results.push(path.join(name, folder_dir[item]));
             }
+            // else { it is a FIFO, or a Socket, Symbolic Link or something ... } 
         }
         return results;
     },

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/2d7f08df/src/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js
index 8c12e2a..0accab2 100644
--- a/src/metadata/wp7_parser.js
+++ b/src/metadata/wp7_parser.js
@@ -213,15 +213,15 @@ module.exports.prototype = {
         // save file
         fs.writeFileSync(this.csproj_path, csproj_xml.write({indent:4}), 'utf-8');
     },
-    // Returns an array of all the files in the given directory with reletive paths
+    // Returns an array of all the files in the given directory with relative paths
     // - name     : the name of the top level directory (i.e all files will start with this
in their path)
-    // - path     : the directory whos contents will be listed under 'name' directory
+    // - dir      : the directory whos contents will be listed under 'name' directory
     folder_contents:function(name, dir) {
         var results = [];
         var folder_dir = fs.readdirSync(dir);
         for(item in folder_dir) {
             var stat = fs.statSync(path.join(dir, folder_dir[item]));
-            // means its a folder?
+ 
             if(stat.isDirectory()) {
                 var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
                 //Add all subfolder item paths
@@ -229,9 +229,10 @@ module.exports.prototype = {
                     results.push(sub_dir[sub_item]);
                 }
             }
-            else {
+            else if(stat.isFile()) {
                 results.push(path.join(name, folder_dir[item]));
             }
+            // else { it is a FIFO, or a Socket or something ... } 
         }
         return results;
     },

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/2d7f08df/src/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp8_parser.js b/src/metadata/wp8_parser.js
index a16127a..3516b91 100644
--- a/src/metadata/wp8_parser.js
+++ b/src/metadata/wp8_parser.js
@@ -219,15 +219,15 @@ module.exports.prototype = {
         // save file
         fs.writeFileSync(this.csproj_path, csproj_xml.write({indent:4}), 'utf-8');
     },
-    // Returns an array of all the files in the given directory with reletive paths
+    // Returns an array of all the files in the given directory with relative paths
     // - name     : the name of the top level directory (i.e all files will start with this
in their path)
-    // - path     : the directory whos contents will be listed under 'name' directory
+    // - dir     : the directory whos contents will be listed under 'name' directory
     folder_contents:function(name, dir) {
         var results = [];
         var folder_dir = fs.readdirSync(dir);
         for(item in folder_dir) {
             var stat = fs.statSync(path.join(dir, folder_dir[item]));
-            // means its a folder?
+
             if(stat.isDirectory()) {
                 var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
                 //Add all subfolder item paths
@@ -235,9 +235,10 @@ module.exports.prototype = {
                     results.push(sub_dir[sub_item]);
                 }
             }
-            else {
+            else if(stat.isFile()) {
                 results.push(path.join(name, folder_dir[item]));
             }
+            // else { it is a FIFO, or a Socket or something ... } 
         }
         return results;
     },


Mime
View raw message