diff --git a/lib/constants.js b/lib/constants.js index fefd9de..68d0b15 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -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; } @@ -137,5 +142,6 @@ module.exports = { isEntitlementFileType, isPlistFileType, isModuleMapFileType, - unquoted + unquoted, + quoteIfNeeded } \ No newline at end of file diff --git a/lib/pbxProject.js b/lib/pbxProject.js index d510221..5d770bf 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -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: [], @@ -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; } diff --git a/package.json b/package.json index 5591b6a..3f78fc5 100644 --- a/package.json +++ b/package.json @@ -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" },