Skip to content

Commit c9a3ee5

Browse files
author
Anis Kadri
committed
Merge branch 'initialxy-master'
2 parents 19879f9 + e4d45d7 commit c9a3ee5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/pbxProject.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

test/removeSourceFile.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)