You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/02/28 06:43:10 UTC

[GitHub] shazron commented on a change in pull request #355: Modified xcodeProjDir to filter out files/folders that contain "._"

shazron commented on a change in pull request #355: Modified xcodeProjDir to filter out files/folders that contain "._"
URL: https://github.com/apache/cordova-ios/pull/355#discussion_r171154623
 
 

 ##########
 File path: bin/templates/scripts/cordova/Api.js
 ##########
 @@ -64,7 +64,17 @@ function Api (platform, platformRootDir, events) {
     var xcodeCordovaProj;
 
     try {
-        xcodeProjDir = fs.readdirSync(this.root).filter(function (e) { return e.match(/\.xcodeproj$/i); })[0];
+
+        var xcodeProjDir_array = fs.readdirSync(this.root).filter(function (e) { return e.match(/\.xcodeproj$/i); });
+        if (xcodeProjDir_array.length > 1) {
+            for (var x = 0; x < xcodeProjDir_array.length; x++) {
+                if (xcodeProjDir_array[x].substring(0, 2) === '._') {
+                    xcodeProjDir_array.splice(x, 1);
+                }
+            }
+        }
+        xcodeProjDir = xcodeProjDir_array[0];
+
 
 Review comment:
   Thanks! I think this would be more efficient and clearer:
   ```javascript
   var xcodeProjDir_array = fs
       .readdirSync(this.root)
       .filter(function (elem) {
           // match .xcodeproj, and not start with '._'
           return elem.match(/\.xcodeproj$/i) && (elem.substring(0, 2) !== '._'); 
       })
   
   xcodeProjDir = xcodeProjDir_array[0];      
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org