Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 4477083

Browse files
author
Max
authored
Fixed issue with error on parsing plist path (#842)
See #534 (comment) for details
1 parent afc7140 commit 4477083

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/postlink/ios/postlink.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ function getDefaultPlistPath() {
105105
return glob.sync(`**/${package.name}/*Info.plist`, ignoreNodeModules)[0];
106106
}
107107

108-
// This is enhanced version of standard implementation of xcode 'getBuildProperty' function
109-
// but allows us to narrow results by PRODUCT_NAME property also.
108+
// This is enhanced version of standard implementation of xcode 'getBuildProperty' function
109+
// but allows us to narrow results by PRODUCT_NAME property also.
110110
// So we suppose that proj name should be the same as package name, otherwise fallback to default plist path searching logic
111111
function getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, prop, targetProductName, build){
112112
var target;
@@ -146,7 +146,7 @@ function getPlistPath(){
146146
var parsedXCodeProj;
147147

148148
try {
149-
var proj = xcode.project(xcodeProjectPath);
149+
var proj = xcode.project(xcodeProjectPath);
150150
//use sync version because there are some problems with async version of xcode lib as of current version
151151
parsedXCodeProj = proj.parseSync();
152152
}
@@ -160,14 +160,16 @@ function getPlistPath(){
160160
var targetProductName = package ? package.name : null;
161161

162162
//Try to get 'Release' build of ProductName matching the package name first and if it doesn't exist then try to get any other if existing
163-
var plistPathValue = getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY, targetProductName, RELEASE_BUILD_PROPERTY_NAME) ||
163+
var plistPathValue = getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY, targetProductName, RELEASE_BUILD_PROPERTY_NAME) ||
164164
getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY, targetProductName) ||
165-
parsedXCodeProj.getBuildProperty(INFO_PLIST_PROJECT_KEY, RELEASE_BUILD_PROPERTY_NAME) ||
165+
parsedXCodeProj.getBuildProperty(INFO_PLIST_PROJECT_KEY, RELEASE_BUILD_PROPERTY_NAME) ||
166166
parsedXCodeProj.getBuildProperty(INFO_PLIST_PROJECT_KEY);
167167

168168
if (!plistPathValue){
169169
return getDefaultPlistPath();
170170
}
171171

172-
return path.resolve(path.dirname(xcodeProjectPath), '..', plistPathValue);
172+
//also remove surrounding quotes from plistPathValue to get correct path resolved
173+
//(see https://github.com/Microsoft/react-native-code-push/issues/534#issuecomment-302069326 for details)
174+
return path.resolve(path.dirname(xcodeProjectPath), '..', plistPathValue.replace(/^"(.*)"$/, '$1'));
173175
}

0 commit comments

Comments
 (0)