Skip to content

Commit b80d21b

Browse files
authored
Merge pull request #13 from NativeScript/fatme/fix-spaces
fix: fix apple watch extension with space in name
2 parents 39d26b1 + f88457f commit b80d21b

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/constants.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ function unquoted(text) {
112112
return text == null ? '' : text.replace (/(^")|("$)/g, '')
113113
}
114114

115+
function quoteIfNeeded(name) {
116+
const quotedName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name;
117+
return quotedName;
118+
}
119+
115120
function isModuleMapFileType(fileType) {
116121
return fileType === FILETYPE_BY_EXTENSION.modulemap;
117122
}
@@ -137,5 +142,6 @@ module.exports = {
137142
isEntitlementFileType,
138143
isPlistFileType,
139144
isModuleMapFileType,
140-
unquoted
145+
unquoted,
146+
quoteIfNeeded
141147
}

lib/pbxProject.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
550550
var groups = this.hash.project.objects['PBXGroup'],
551551
pbxGroupUuid = opt.uuid || this.generateUuid(),
552552
commentKey = f("%s_comment", pbxGroupUuid),
553-
groupName = (name.indexOf(" ") >= 0 || name.indexOf("@") >= 0) && name[0] !== `"` ? `"${name}"` : name,
553+
groupName = constants.quoteIfNeeded(name),
554554
pbxGroup = {
555555
isa: 'PBXGroup',
556556
children: [],
@@ -611,7 +611,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
611611
}
612612

613613
if(isEntitlementFileType(file.lastKnownFileType)) {
614-
this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', file.path, opt.target);
614+
this.addToBuildSettings('CODE_SIGN_ENTITLEMENTS', constants.quoteIfNeeded(file.path), opt.target);
615615
continue;
616616
}
617617

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "nativescript-dev-xcode",
44
"description": "parser for xcodeproj/project.pbxproj files",
55
"main": "index.js",
6-
"version": "0.2.0",
6+
"version": "0.2.1",
77
"repository": {
88
"url": "https://github.com/NativeScript/nativescript-dev-xcode.git"
99
},

0 commit comments

Comments
 (0)