Skip to content

Commit 185a9ab

Browse files
committed
fix: fix apple watch extension with space in name
Rel to: NativeScript/nativescript-cli#5005
1 parent 39d26b1 commit 185a9ab

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
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 quote(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+
quote
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.quote(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.quote(file.path), opt.target);
615615
continue;
616616
}
617617

0 commit comments

Comments
 (0)