Skip to content

Commit 98a8bd9

Browse files
committed
fix: uuid module overwritten
1 parent 8e2ba68 commit 98a8bd9

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/pbxProject.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var util = require('util'),
1919
f = util.format,
2020
EventEmitter = require('events').EventEmitter,
2121
$path = require('path'),
22-
uuid = require('uuid'),
22+
$uuid = require('uuid'),
2323
fork = require('child_process').fork,
2424
pbxWriter = require('./pbxWriter'),
2525
pbxFile = require('./pbxFile').pbxFile,
@@ -91,7 +91,7 @@ pbxProject.prototype.allUuids = function() {
9191
}
9292

9393
pbxProject.prototype.generateUuid = function() {
94-
var id = uuid.v4()
94+
var id = $uuid.v4()
9595
.replace(/-/g, '')
9696
.substr(0, 24)
9797
.toUpperCase()
@@ -482,19 +482,19 @@ pbxProject.prototype.addToPbxBuildFileSection = function(file) {
482482
}
483483

484484
pbxProject.prototype.removeFromPbxBuildFileSection = function(file) {
485-
var uuid;
485+
var fileUuid;
486486

487-
for (uuid in this.pbxBuildFileSection()) {
488-
if (this.pbxBuildFileSection()[uuid].fileRef_comment == file.basename) {
489-
file.uuid = uuid;
490-
this.removeFromPbxBuildFileSectionByUuid(uuid);
487+
for (fileUuid in this.pbxBuildFileSection()) {
488+
if (this.pbxBuildFileSection()[fileUuid].fileRef_comment == file.basename) {
489+
file.uuid = fileUuid;
490+
this.removeFromPbxBuildFileSectionByUuid(fileUuid);
491491
}
492492
}
493493
}
494494

495-
pbxProject.prototype.removeFromPbxBuildFileSectionByUuid = function(uuid) {
495+
pbxProject.prototype.removeFromPbxBuildFileSectionByUuid = function(itemUuid) {
496496
var buildSection = this.pbxBuildFileSection();
497-
removeItemAndCommentFromSectionByUuid(buildSection, uuid);
497+
removeItemAndCommentFromSectionByUuid(buildSection, itemUuid);
498498
}
499499

500500
pbxProject.prototype.findMainPbxGroup = function () {
@@ -1639,8 +1639,8 @@ pbxProject.prototype.removeTarget = function(target, targetKey) {
16391639

16401640
//remove files from all build phases from PBXBuildFile section
16411641
for (let k = 0; k < files.length; k++) {
1642-
const uuid = files[k].value;
1643-
this.removeFromPbxBuildFileSectionByUuid(uuid);
1642+
const fileUuid = files[k].value;
1643+
this.removeFromPbxBuildFileSectionByUuid(fileUuid);
16441644
}
16451645

16461646
//remove target from the project itself
@@ -1712,7 +1712,7 @@ pbxProject.prototype.removeTarget = function(target, targetKey) {
17121712
removeItemAndCommentFromSectionByUuid(pbxCopySection, copyPhaseId);
17131713
} else {
17141714
//if there are other files in the copy phase, just remove the product
1715-
copyPhase.files(p, 1);
1715+
copyPhase.files.splice(p, 1);
17161716
}
17171717
break;
17181718
}
@@ -1769,10 +1769,10 @@ pbxProject.prototype.removeTarget = function(target, targetKey) {
17691769
this.removePbxGroup(unquote(target.name));
17701770
};
17711771

1772-
function removeItemAndCommentFromSectionByUuid(section, uuid) {
1773-
var commentKey = f("%s_comment", uuid)
1772+
function removeItemAndCommentFromSectionByUuid(section, itemUuid) {
1773+
var commentKey = f("%s_comment", itemUuid)
17741774
delete section[commentKey];
1775-
delete section[uuid];
1775+
delete section[itemUuid];
17761776
}
17771777

17781778
// helper recursive prop search+replace

0 commit comments

Comments
 (0)