alunny / node-xcode

tools and utilities for working with xcode/ios projects
Apache License 2.0
225 stars 105 forks source link

Issue with setting appex extension on add target #105

Open ajnrajeev opened 7 years ago

ajnrajeev commented 7 years ago

Hi, I am using version": "0.8.9". I was adding a target using addTarget(tgtNameStr, 'app_extension'), but the resultant target is set as .undefined. It looks like the function defaultExtension is creating an issue in pbxFile.js

var filetype = fileRef.lastKnownFileType || fileRef.explicitFileType;

This is settings filetype to unknown since fileRef.lastKnownFileType gets set as such in pbxFile(). After changing the order here, to pick explicitFileType first if present, the following condition created an issue

if(FILETYPE_BY_EXTENSION[unquoted(extension)] === filetype )

because _FILETYPE_BYEXTENSION[unquoted(extension)] was evaluating to wrapper.app-extension whereas filetype was "wrapper.app-extension", with the quotes.

It is working for me after I made 2 changes

var filetype = fileRef.explicitFileType || fileRef.lastKnownFileType;

if(FILETYPE_BY_EXTENSION[unquoted(extension)] === unquoted(filetype) )

Not sure if this is the right way to handle this since the function is a common one. Please take a look.

Regards Anjana