File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,9 @@ pbxProject.prototype.removeFromPbxFileReferenceSection = function (file) {
277277 var refObj = pbxFileReferenceObj ( file ) ;
278278 for ( i in this . pbxFileReferenceSection ( ) ) {
279279 if ( this . pbxFileReferenceSection ( ) [ i ] . name == refObj . name ||
280- this . pbxFileReferenceSection ( ) [ i ] . path == refObj . path ) {
280+ ( '"' + this . pbxFileReferenceSection ( ) [ i ] . name + '"' ) == refObj . name ||
281+ this . pbxFileReferenceSection ( ) [ i ] . path == refObj . path ||
282+ ( '"' + this . pbxFileReferenceSection ( ) [ i ] . path + '"' ) == refObj . path ) {
281283 file . fileRef = file . uuid = i ;
282284 delete this . pbxFileReferenceSection ( ) [ i ] ;
283285 break ;
Original file line number Diff line number Diff line change @@ -126,6 +126,21 @@ exports.removeSourceFile = {
126126
127127 test . ok ( ! sourceObj ) ;
128128 test . done ( ) ;
129+ } ,
130+ 'should remove file from PBXFileReference after modified by Xcode' : function ( test ) {
131+ var fileRef = proj . addSourceFile ( 'Plugins/file.m' ) . fileRef ;
132+
133+ // Simulate Xcode's behaviour of stripping quotes around path and name
134+ // properties.
135+ var entry = proj . pbxFileReferenceSection ( ) [ fileRef ] ;
136+ entry . name = entry . name . replace ( / ^ " ( .* ) " $ / , "$1" ) ;
137+ entry . path = entry . path . replace ( / ^ " ( .* ) " $ / , "$1" ) ;
138+
139+ var newFile = proj . removeSourceFile ( 'Plugins/file.m' ) ;
140+
141+ test . ok ( newFile . uuid ) ;
142+ test . ok ( ! proj . pbxFileReferenceSection ( ) [ fileRef ] ) ;
143+ test . done ( ) ;
129144 }
130145}
131146
You can’t perform that action at this time.
0 commit comments