[ 
https://issues.apache.org/jira/browse/CB-13927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16381337#comment-16381337
 ] 

ASF GitHub Bot commented on CB-13927:
-------------------------------------

shazron commented on a change in pull request #355: CB-13927 - 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, what do you think?:
   ```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:
us...@infra.apache.org


> Modified xcodeProjDir to filter out files/folders that contain "._"
> -------------------------------------------------------------------
>
>                 Key: CB-13927
>                 URL: https://issues.apache.org/jira/browse/CB-13927
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-ios
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>            Priority: Major
>
> I ran into an issue trying to add an ios plugin using a virtual machine. The 
> code would return an array for the xcodeProjDir and then of course use the 
> wrong one. It would use the one starting with "._ProjectName" which I believe 
> is an MacOS hidden folder. I attempted to install the plugin on OsX but 
> because it's a virtual machine it still had those hidden folders. I've made 
> it so that it will filter those out while looking for the proper xCode 
> project folder.
> h3. *Platforms affected*
> Windows (host) / OSx (guest) virtual machines
> h3. *What does this PR do?*
> Fixes a folder issue. Before it would try to use an incorrect folder for the 
> xCode project.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to