File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,10 @@ pbxProject.prototype.pbxBuildFileSection = function () {
298298 return this . hash . project . objects [ 'PBXBuildFile' ] ;
299299}
300300
301+ pbxProject . prototype . pbxXCBuildConfigurationSection = function ( ) {
302+ return this . hash . project . objects [ 'XCBuildConfiguration' ] ;
303+ }
304+
301305pbxProject . prototype . pbxFileReferenceSection = function ( ) {
302306 return this . hash . project . objects [ 'PBXFileReference' ] ;
303307}
@@ -348,6 +352,24 @@ pbxProject.prototype.buildPhaseObject = function (name, group) {
348352 return null ;
349353}
350354
355+ pbxProject . prototype . updateProductName = function ( name ) {
356+ var config = this . pbxXCBuildConfigurationSection ( ) ;
357+ propReplace ( config , 'PRODUCT_NAME' , '"' + name + '"' ) ;
358+ } ;
359+
360+ // helper recursive prop search+replace
361+ function propReplace ( obj , prop , value ) {
362+ for ( var p in obj ) {
363+ if ( obj . hasOwnProperty ( p ) ) {
364+ if ( typeof obj [ p ] == 'object' ) {
365+ propReplace ( obj [ p ] , prop , value ) ;
366+ } else if ( p == prop ) {
367+ obj [ p ] = value ;
368+ }
369+ }
370+ }
371+ }
372+
351373// helper object creation functions
352374function pbxBuildFileObj ( file ) {
353375 var obj = Object . create ( null ) ;
You can’t perform that action at this time.
0 commit comments