Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8D017109B3 for ; Wed, 27 Nov 2013 22:27:05 +0000 (UTC) Received: (qmail 64863 invoked by uid 500); 27 Nov 2013 22:27:02 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 64505 invoked by uid 500); 27 Nov 2013 22:27:02 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 63878 invoked by uid 99); 27 Nov 2013 22:27:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2013 22:27:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1C24390EF99; Wed, 27 Nov 2013 22:27:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Wed, 27 Nov 2013 22:27:33 -0000 Message-Id: In-Reply-To: <31693a31af234d8a845eb70b8938dee7@git.apache.org> References: <31693a31af234d8a845eb70b8938dee7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [34/51] [abbrv] git commit: correctly resolve file/directories using fs provided methods 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 Authored: Tue Nov 26 12:13:09 2013 -0800 Committer: Jesse MacFadyen 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; },