Skip to content

Commit

Permalink
Merge pull request #13 from NativeScript/fatme/fix-spaces
Browse files Browse the repository at this point in the history
fix: fix apple watch extension with space in name
  • Loading branch information
Fatme authored Oct 4, 2019
2 parents 39d26b1 + f88457f commit b80d21b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ function unquoted(text) {
return text == null ? '' : text.replace (/(^")|("$)/g, '')
}

function quoteIfNeeded(name) {
const quotedName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name;
return quotedName;
}

function isModuleMapFileType(fileType) {
return fileType === FILETYPE_BY_EXTENSION.modulemap;
}
Expand All @@ -137,5 +142,6 @@ module.exports = {
isEntitlementFileType,
isPlistFileType,
isModuleMapFileType,
unquoted
unquoted,
quoteIfNeeded
}
4 changes: 2 additions & 2 deletions lib/pbxProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
var groups = this.hash.project.objects['PBXGroup'],
pbxGroupUuid = opt.uuid || this.generateUuid(),
commentKey = f("%s_comment", pbxGroupUuid),
groupName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name,
groupName = constants.quoteIfNeeded(name),
pbxGroup = {
isa: 'PBXGroup',
children: [],
Expand Down Expand Up @@ -611,7 +611,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
}

if(isEntitlementFileType(file.lastKnownFileType)) {
this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', file.path, opt.target);
this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', constants.quoteIfNeeded(file.path), opt.target);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "nativescript-dev-xcode",
"description": "parser for xcodeproj/project.pbxproj files",
"main": "index.js",
"version": "0.2.0",
"version": "0.2.1",
"repository": {
"url": "https://github.com/NativeScript/nativescript-dev-xcode.git"
},
Expand Down

0 comments on commit b80d21b

Please sign in to comment.