Skip to content

Commit

Permalink
format asset tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Renshaw authored and goff-marocchi committed Jun 12, 2020
1 parent f818f1a commit b7ac07a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/pbxProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -2200,6 +2200,7 @@ pbxProject.prototype.removeTargetAttribute = function(prop, target) {
}

pbxProject.prototype.addAssetTag = function(assetTagName, resourcesFolder) {
assetTagName = sanitiseTag(assetTagName)
var project = this.getFirstProject()['firstProject'];
if (project['attributes'] === undefined) {
project['attributes'] = {};
Expand All @@ -2222,6 +2223,14 @@ pbxProject.prototype.addAssetTag = function(assetTagName, resourcesFolder) {
})
}

function sanitiseTag(tag) {
return `"${tag}"`
}

function stripQuotes(tag) {
return tag.replace(/"/g, "")
}

pbxProject.prototype.removeTaggedResourceFiles = function() {
for (const [ uuid, value ] of Object.entries(this.pbxBuildFileSection())) {
// console.log(value);
Expand All @@ -2247,7 +2256,7 @@ pbxProject.prototype.removeTaggedResourceFiles = function() {
if (attributes['KnownAssetTags'] == undefined) {
return []
}
return attributes['KnownAssetTags']
return attributes['KnownAssetTags'].map(stripQuotes)
}

pbxProject.prototype.removeAssetTags = function() {
Expand Down

0 comments on commit b7ac07a

Please sign in to comment.