You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/01/17 03:55:18 UTC

[GitHub] [cordova-ios] leogoesger commented on a change in pull request #765: Fix error parsing plist_file_entry when adding extension in xcode

leogoesger commented on a change in pull request #765: Fix error parsing plist_file_entry when adding extension in xcode
URL: https://github.com/apache/cordova-ios/pull/765#discussion_r367759258
 
 

 ##########
 File path: bin/templates/scripts/cordova/lib/projectFile.js
 ##########
 @@ -40,8 +40,18 @@ function parseProjectFile (locations) {
     const xcodeproj = xcode.project(pbxPath);
     xcodeproj.parseSync();
 
-    const xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection();
-    const plist_file_entry = _.find(xcBuildConfiguration, entry => entry.buildSettings && entry.buildSettings.INFOPLIST_FILE);
+    var projectName = '';
+    if (fs.readdirSync(project_dir).find(d => d.includes('.xcworkspace'))) {
+        projectName = fs.readdirSync(project_dir).find(d => d.includes('.xcworkspace')).replace('.xcworkspace', '');
+    }
+    var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection();
+    var plist_file_entry = _.find(xcBuildConfiguration, function (entry) {
+        return (
+            entry.buildSettings &&
+            entry.buildSettings.INFOPLIST_FILE &&
+            projectName ? entry.buildSettings.INFOPLIST_FILE.includes(projectName) : true
+        );
+    });
     const plist_file = path.join(project_dir, plist_file_entry.buildSettings.INFOPLIST_FILE.replace(/^"(.*)"$/g, '$1').replace(/\\&/g, '&'));
 
 Review comment:
   Thanks,  I have never worked in xcode before, nor in Cordova before. As far as JS goes,
   
   `MyAppExtension-Info.plist".includes("MyApp-Info.plist")` is false. The only way to match it would be `ExtensionMyApp-Info.plist".includes("MyApp-Info.plist")`. Instead of doing the check, it might be easier to just use `entry.buildSettings.INFOPLIST_FILE === ${projectName}-Info.plist`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org