Skip to content

Commit 915ef35

Browse files
committed
adding support for adding/removing from library search paths
1 parent 3d20386 commit 915ef35

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

lib/pbxProject.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pbxProject.prototype.addStaticLibrary = function (path, opt) {
231231

232232
this.addToPbxBuildFileSection(file); // PBXBuildFile
233233
this.addToPbxFrameworksBuildPhase(file); // PBXFrameworksBuildPhase
234-
this.ensureCorrectSearchPaths(file); // make sure it gets built!
234+
this.addToLibrarySearchPaths(file); // make sure it gets built!
235235

236236
return file;
237237
}
@@ -443,7 +443,33 @@ pbxProject.prototype.updateProductName = function(name) {
443443
propReplace(config, 'PRODUCT_NAME', '"' + name + '"');
444444
}
445445

446-
pbxProject.prototype.ensureCorrectSearchPaths = function (file) {
446+
pbxProject.prototype.removeFromLibrarySearchPaths = function (file) {
447+
var configurations = nonComments(this.pbxXCBuildConfigurationSection()),
448+
INHERITED = '"$(inherited)"',
449+
SEARCH_PATHS = 'LIBRARY_SEARCH_PATHS',
450+
config, buildSettings, searchPaths;
451+
var new_path = searchPathForFile(file, this);
452+
453+
for (config in configurations) {
454+
buildSettings = configurations[config].buildSettings;
455+
456+
if (unquote(buildSettings['PRODUCT_NAME']) != this.productName)
457+
continue;
458+
459+
if (buildSettings[SEARCH_PATHS]) {
460+
var matches = buildSettings[SEARCH_PATHS].filter(function(p) {
461+
return p.indexOf(new_path) > -1;
462+
});
463+
matches.forEach(function(m) {
464+
var idx = buildSettings[SEARCH_PATHS].indexOf(m);
465+
buildSettings[SEARCH_PATHS].splice(idx, 1);
466+
});
467+
}
468+
469+
}
470+
}
471+
472+
pbxProject.prototype.addToLibrarySearchPaths = function (file) {
447473
var configurations = nonComments(this.pbxXCBuildConfigurationSection()),
448474
INHERITED = '"$(inherited)"',
449475
config, buildSettings, searchPaths;

0 commit comments

Comments
 (0)