Skip to content

Commit

Permalink
CB-13927 - Modified xcodeProjDir to filter out files/folders that con…
Browse files Browse the repository at this point in the history
…tain "._" (#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.
  • Loading branch information
asoap authored and shazron committed Jan 9, 2019
1 parent fe01e5d commit 1cf9224
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/templates/scripts/cordova/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down

0 comments on commit 1cf9224

Please sign in to comment.