You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2019/01/09 05:28:35 UTC

[cordova-ios] branch master updated: CB-13927 - Modified xcodeProjDir to filter out files/folders that contain "._" (#355)

This is an automated email from the ASF dual-hosted git repository.

shazron pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new 1cf9224  CB-13927 - Modified xcodeProjDir to filter out files/folders that contain "._" (#355)
1cf9224 is described below

commit 1cf92246d5463f519bab76e573078a76d58f9c68
Author: Derek <de...@caffeinedreams.ca>
AuthorDate: Wed Jan 9 06:28:30 2019 +0100

    CB-13927 - Modified xcodeProjDir to filter out files/folders that contain "._" (#355)
    
    * Modified xcodeProjDir to filter out files/folders that contain "._"
    
    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.
---
 bin/templates/scripts/cordova/Api.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bin/templates/scripts/cordova/Api.js b/bin/templates/scripts/cordova/Api.js
index e193c3c..c59b573 100644
--- a/bin/templates/scripts/cordova/Api.js
+++ b/bin/templates/scripts/cordova/Api.js
@@ -66,7 +66,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];
+
         if (!xcodeProjDir) {
             throw new CordovaError('The provided path "' + this.root + '" is not a Cordova iOS project.');
         }


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